I don't know if you're still interested in this problem Hailong, but here is a partial result. I make two natural restrictions :
Restriction 1 : avoid small primes. Let $B_n$ denote the (infinite) set of integers all of whose prime factors are $>n$. I assume that the all the $a_i$ are in $B_n$ (this is to avoid the difficulty that for example when $n=3$ and $k=1$, (*) has a solution when $a_1=a_2=a_3=p$ for $p$ a prime $ >2 $ , but not when $a_1=a_2=a_3=2$ ).
Restriction 2 : avoid small $k$. I assume that $k \geq \frac{n}{2}$ (this is to avoid the difficulty that for example when $n=4$ and $a_1=a_2=2,a_3=a_4=3$, (*) has a solution for $k=2$ but not for $k=1$). Under those restrictions, the following conditions are equivalent :
(i) (*) has a solution in the desired range. (ii) No $a_i$ is prime to all the others $a_j$. (iii) The polynomial $F=\prod_{i=1}^{n}G_i$ is nonzero, where $G_i$ is the polynomial $\sum_{j\neq i}(a_ia_j-\text{lcm}(a_i,a_j))$.
Note that the polynomial is independent of $k$.
The only difficult implication is $(ii) \rightarrow (i)$. To show this, consider the undirected graph $G$ whose vertices are the integers from $1$ to $n$ and such that there is an edge joining $i$ to $j$ iff $gcd(a_i,a_j)>1$. Then condition (ii) says that $G$ is connected. By a straightforward graph-theoretic lemma, there is a subgraph of $G$ which is a disjoint union of stars. Thus, we can write $\lbrace 1,2, \ldots n\rbrace$ as a disjoint union $A_1 \cup A_2 \cup \ldots \cup A_t (t \geq 1)$ such that for each $l$ between $1$ and $t$ we have $|A_l| \geq 2$ and there is a distinguished vertex $u_l$ in $A_l$ that is connected to all the other vertices in $A_l$. Restriction 2 ensures that we can find a decomposition $k=\sum_{l=1}^{t}\alpha_l$ where each $\alpha_l$ is an integer with $0<\alpha_l < |A_l|$. Restriction 1 ensures that we may find, for each $l$ $(x_i)_{i\in A_l}$ such that $0<x_i<a_i (i\in A_l)$ and $\sum_{i\in A_l}\frac{x_i}{a_i}=\alpha_l$. So we are done.