<s>[INST] How to prove Lagrange trigonometric identity I would to prove that 
$$1+\cos \theta+\cos 2\theta+\ldots+\cos n\theta =\displaystyle\frac{1}{2}+ 
\frac{\sin\left[(2n+1)\frac{\theta}{2}\right]}{2\sin\left(\frac{\theta}{2}\right)}$$
given that 
$$1+z+z^2+z^3+\ldots+z^n=\displaystyle\frac {1-z^{n+1}}{1-z}$$
where $z\neq 1$.
I put $z=e^{i\theta}$. I already got in left hand side cos exp in real part, but there is a problem in the right hand side, I can't split imaginary part and real part. Please help me. Thanks in advance.
 [/INST] Here's a variation of @lab's variation of @DonAntonio's solution:
$$\begin{align}
\frac{e^{(n+1)i\theta}-1}{e^{i\theta-1}-1} 
&= \frac{e^{(n+1)i\theta}-1}{e^{i\theta/2} \left(e^{i\theta/2}-e^{-i\theta/2}\right)} \\
&= \frac{e^{(n+1/2)i\theta}-e^{-i\theta/2}}{2i\sin\frac{\theta}{2}} \\
&= \frac{\mathrm{cis}\frac{(2n+1)i\theta}{2}-\mathrm{cis}\frac{-\theta}{2}}{2i\sin\frac{\theta}{2}} \\
&= \frac{-i\;\left(\mathrm{cis}\frac{(2n+1)i\theta}{2}-\mathrm{cis}\frac{-\theta}{2}\right)}{2\sin\frac{\theta}{2}} \\
\end{align}
$$
where, of course, "$\mathrm{cis}\,x := \cos x + i \sin x$". The real part is then
$$\begin{align}
\frac{1}{2\sin\frac{\theta}{2}}\left(-i^2\sin\frac{(2n+1)\theta}{2}+i^2\sin\frac{-\theta}{2}\right) 
&= \frac{1}{2\sin\frac{\theta}{2}}\left(\sin\frac{(2n+1)\theta}{2}+\sin\frac{\theta}{2}\right) \\
&= \frac{1}{2}\left(\frac{\sin\frac{(2n+1)\theta}{2}}{\sin\frac{\theta}{2}}+1\right)
\end{align}$$
In this variation, we avoid appealing to the lesser-known sine-times-cosine prosthaphaeresis identity (although that identity is helpful to know!).
</s>