Set $x=0$ for a start giving $$a_1+a_3+a_5=0$$
Try some other convenient particular values of $x$ and you get a system of linear equations in the $a_i$. Choose well and the equations give no non-trivial solutions.
This uses the fact that an identity in $x$ must hold for particular values of $x$
Taking also $x=\frac \pi 2, \pi, \frac {3\pi}2$ gives
$$a_1+a_2-a_5=0$$
$$a_1-a_3+a_5=0$$
$$a_1-a_2-a_5=0$$
Add the four equations to obtain $4a_1=0$ so that $a_1=0$
Add the first two (noting $a_1=0$) to get $a_2+a_3=0$. Add the middle two to get $a_2-a_3=0$ whence $a_2=a_3=0$. Then $a_5=0$ from any equation, and going back to the original identity $a_4=0$
Fourier analysis works easily because it picks out one term from the original sum, and easily solves generalisations of this. The method here works by sampling - and to get an easy calculation, you have to choose the right values of $x$ to sample.