Fourier Transform/Series DFT/DFS textbook problem (simple?)
Your result

$$x[n]=\sum_{k=-9}^9a_ke^{j2\pi kn/N}\tag{1}$$

with $N=6$ is correct. If you compare $(1)$ to the IDFT (or DFS)

$$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi kn/N}\tag{2}$$

you'll notice that in $(2)$ each term $e^{j2\pi kn/N}$ occurs only once for each value of $k$ (for fixed $n$), whereas in $(1)$, due to the periodicity of the complex exponential, each term $e^{j2\pi kn/N}$ occurs several times. E.g., for $k=0$ in $(2)$, in $(1)$ you get contributions for $k=0$, for $k=6$, and for $k=-6$ (because $N=6$). Consequently, comparing $(1)$ and $(2)$ gives

$$X[0]=N(a_0+a_6+a_{-6})$$

For all other values of $k$, the procedure is completely analogous: search for indices $k$ in $(1)$ which have the same complex exponential term $e^{j2\pi kn/N}$. You basically have to keep adding and subtracting the number $N=6$ to the indices, as long you remain in the range $|k|\le 9$, so e.g. for $X[2]$ you get contributions for $k=2$, $k=2+6=8$, and $k=2-6=-4$, because they all have the same exponential term $e^{j4\pi n/N}$.

PS: The term $2\pi$ in your textbook result doesn't make sense to me, it should be $N$, as already pointed out in a comment.