They are given by Viète's formulas, which in the case of monic polynomials are equivalent to the elementary symmetric polynomials in the $a_i$.
The coefficient of degree $k$ will be the sum of all possible products of $n-k$ distinct factors taken from $a_1,\ldots,a_n$. There are $\binom{n}{n-k} = \frac{n!}{k!(n-k)!}$ such products.
For example, if $n=7$, then the coefficient of $x^2$ will be $\begin{align*} a_1a_2a_3a_4a_5 &+a_1a_2a_3a_4a_6 + a_1a_2a_3a_4a_7 + a_1a_2a_3a_5a_6 +a_1a_2a_3a_5a_7\\ &+ a_1a_2a_3a_6a_7 + a_1a_2a_4a_5a_6 + a_1a_2a_4a_5a_7 +a_1a_2a_4a_6a_7\\ &+ a_1a_2a_5a_6a_7+ a_1a_3a_4a_5a_6 + a_1a_3a_4a_5a_7 +a_1a_3a_4a_6a_7\\ &+ a_1a_3a_5a_6a_7 + a_1a_4a_5a_6a_7 + a_2a_3a_4a_5a_6 + a_2a_3a_4a_5a_7\\&+ a_2a_3a_4a_6a_7 + a_2a_3a_5a_6a_7 + a_2a_4a_5a_6a_7 + a_3a_4a_5a_6a_7. \end{align*}$ All $\frac{7!}{2!5!} = \frac{7\times 6}{2} = 21$ possible products of five distinct factors taken from $a_1,a_2,a_3,a_4,a_5,a_6,a_7$.