Not a complete answer. $P(x)$ irreducible and $a_{n-1} \neq 0$ are necessary, as you say. I don't understand your notation regarding the reducible case, but if $P(x) = Q(x) R(x)$ then the roots of $Q(x)$ sum up to something rational and so do the roots of $R(x)$, so some rational linear combination of these two sums is zero.
Next, if $P(x)$ is irreducible and $a_{n-1} \neq 0$, write $I$ for the set of roots of $P(x)$, where the root corresponding to $i \in I$ is denoted $\alpha_i$, and write $G$ for its Galois group. Consider the space $V$ of vectors $(\lambda_i) \in \mathbb{Q}^I$ such that $\sum \lambda_i \alpha_i = 0$; since applying an element of the Galois group to such a linear dependence produces another linear dependence, $V$ is a $G$-submodule of $\mathbb{Q}^I$. Averaging over $G$, we get that if $\sum \lambda_i \alpha_i = 0$ then
$$\frac{1}{|G|} \sum_{g \in G} g \sum \lambda_i \alpha_i = \sum \lambda_i \frac{\sum \alpha_i}{n} = 0$$
so if $a_{n-1} \neq 0$ then $\sum \lambda_i = 0$; so our $G$-module $V$ of linear dependencies lives in the submodule of $\mathbb{Q}^I$ of vectors summing to zero. Call this submodule $W$.
Proposition: $W$ is irreducible iff $G$ acts doubly transitively on the roots.
Proof. Write $\chi$ for the character of $W$. Then $\chi + 1$ is the character of $\mathbb{Q}^I$, which is $\text{Fix}(g)$, the number of fixed points of $g \in G$ acting on the roots. Hence
$$\langle \chi + 1, \chi + 1 \rangle = \frac{1}{|G|} \sum_{g \in G} \text{Fix}(g)^2$$
and by Burnside's lemma this is the number of orbits of $G$ acting on $I \times I$. On the other hand, $\langle \chi + 1, \chi + 1 \rangle = \langle \chi, \chi \rangle + 1$ ($\langle \chi, 1 \rangle = 0$ because the action of $G$ on the roots is always transitive, which gives $\langle \chi + 1, 1 \rangle = 1$, again by Burnside's lemma). So $\chi$ is irreducible iff $\langle \chi, \chi \rangle = 1$ iff $G$ has exactly two orbits on $I \times i$, which is exactly the condition that $G$ acts doubly transitively (since the diagonal $(i, i)$ is always an orbit). $\Box$
Corollary: With the above hypotheses, if $G$ acts doubly transitively on the roots then the roots are linearly independent.
This implies in particular that the roots are linearly independent if $G = S_n$ but various other Galois groups are possible, such as the affine linear groups $AGL_1(\mathbb{F}_p) \cong \mathbb{F}_p \rtimes \mathbb{F}_p^{\times}$ acting on $\mathbb{F}_p$.
Proof. If $G$ acts doubly transitively on the roots then it acts irreducibly on $W$, as above. It follows that if $\sum \lambda_i \alpha_i = 0$ is a nontrivial linear dependence among the roots then $V$ is nonzero, hence (by irreducibility) must be all of $W$. But $W$ contains all permutations of vectors of the form $(1, -1, \dots 0)$, which gives that $\alpha_i - \alpha_j = 0$ for all $i \neq j$; contradiction. So $V = 0$, meaning there are no nontrivial linear dependencies among the roots. $\Box$
This condition is not necessary, since for example the roots of $P(x) = \frac{x^p - 1}{x - 1} = \Phi_p(x)$, for $p$ a prime, are also linearly independent but the Galois group, which is $\mathbb{F}_p^{\times}$, does not act double transitively. Apparently it's known that the primitive $n^{th}$ roots of unity (so the roots of $\Phi_n(x)$) are linearly independent iff $n$ is squarefree but I don't know a proof or reference.
Edit: Ah, I've missed an obvious generalization that covers the case of $\Phi_p(x)$. Double transitivity actually shows that $W \otimes_{\mathbb{Q}} \mathbb{C}$ is irreducible, whereas for the above argument to go through it suffices that $W$ itself is irreducible, over $\mathbb{Q}$, which is true in the case of $\Phi_p(x)$. I don't know how to check irreducibility over $\mathbb{Q}$ in general, though. I guess it is necessary and sufficient that the irreducible components of $W$ over $\mathbb{C}$ form a single Galois orbit.