Using that $1 + z + z^{2} + ... + z^{n} = \frac{1-z^{n+1}}{1-z}$ and taking the real parts, prove that: $$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \frac12+\frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})} $$
for $0 < \theta < 2\pi$.
Alright. What I have done is this, using the De Moivre's Formula:
$$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \operatorname{Re}(1 + (\cos\theta + i\sin\theta) + (\cos2\theta + i\sin2\theta) + ... + (\cos n\theta + i \sin n \theta))$$
That is equivalent to
$$ \operatorname{Re}(1 + e^{i\theta} + e^{2i\theta} + ... e^{ni\theta}) = \operatorname{Re} \biggl(\frac{1 - e^{(n+1)i\theta}}{1 - e^{i\theta}}\biggr)$$
I've reached to this point, but now I don't know what to do. Any hint or idea?
 A: Hint:
Factor out $\;\mathrm e^{\tfrac{(n+1)i\theta}2}$ in the numerator and  $\;\mathrm e^{\tfrac{i\theta}2}$  in the denominator, and use Euler's formulæ.
A: $$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})} $$
Using De moivre's theorem you arrived that
$$ \operatorname{Re}(1 + e^{i\theta} + e^{2i\theta} + ... e^{ni\theta}) = \operatorname{Re} \biggl(\frac{1 - e^{(n+1)i\theta}}{1 - e^{i\theta}}\biggr)$$
Now will reverse-engineer the process back to trigonomety using
$$e^{ix} = \cos(x)+i\sin(x)$$
$$\operatorname{Re} \biggl( \frac{ 1 -( \cos{(n+1)\theta}+i\sin{(n+1)\theta} )}{ 1 - ( \cos{\theta}+i\sin{\theta} ) }\biggr)$$
$$\frac{ 1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta}}{ 1 - \cos{\theta}- i\sin{\theta} }$$
We would now multiply the numerator and the denominator by the conjugate of the denominator $1 - \cos{\theta} + i\sin{\theta}$
$$\frac{ 1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta} }{ 1 - \cos{\theta}- i\sin{\theta} }\cdot\frac{1 - \cos{\theta} + i\sin{\theta}}{1 - \cos{\theta} + i\sin{\theta}}$$
$$\frac{ (1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta})\cdot(1 - \cos{\theta} + i\sin{\theta} )}{ (1 - \cos{\theta}- i\sin{\theta})\cdot(1 - \cos{\theta} + i\sin{\theta}) }$$
$$\frac{ (1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta})\cdot(1 - \cos{\theta} + i\sin{\theta} )}{ (1 - \cos{\theta} )^2 - (i\sin{\theta})^2 }$$
Now since the denominator is off imaginary number, it's easy to equate $\mathbb{R}$
$$\frac{ (1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta})\cdot(1 - \cos{\theta} + i\sin{\theta} )}{ (1 - \cos{\theta} )^2 + (\sin{\theta})^2 }$$
$$\frac{ (\sin{\theta}*\sin{(n+1)\theta}+\cos{\theta}*\cos{(n+1)\theta}-\cos{(n+1)\theta}-\cos{\theta}+1) + i\cdot(\cos{\theta}*\sin{(n+1)\theta}-\sin{(n+1)\theta}-\sin{\theta}*\cos{(n+1)\theta}+\sin{\theta}) }{ (1 - \cos{\theta} )^2 + (\sin{\theta})^2 }$$
so when we take away imaginary the expression becomes
$$\frac{ (\sin{\theta}*\sin{(n+1)\theta}+\cos{\theta}*\cos{(n+1)\theta}-\cos{(n+1)\theta}-\cos{\theta}+1) }{ (1 - \cos{\theta} )^2 + (\sin{\theta})^2 }$$
let's simplify further
$$\frac{-1\cos{(n+1)\theta}+\cos{n\theta}-\cos{\theta}+1 }{ 1-2\cos{\theta}+(\cos{\theta} )^2 + (\sin{\theta})^2 }$$
$$\frac{ -1\cos{(n+1)\theta}+\cos{n\theta}-\cos{\theta}+1 }{ 2 -2\cos{\theta} }$$
We still simplify further to reduce this
it turns out that $- H  = \frac{1}{2} + \frac{\sin{(n+\frac{1}{2})\theta} }{2\sin{\frac{\theta}{2}}}$, and there was no mistake in my calculations
$$H = \frac{ -1\cos{(n+1)\theta}+\cos{n\theta}-\cos{\theta}+1 }{ 2 -2\cos{\theta} }$$

Proof of error, remember $$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})} $$, say $n=1$
But $$ 1+\cos{\theta} ≠ \frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})}$$, for every $\theta$ it doesn't turn out to be equal because it is with a displacement of $\frac{1}{2}$
So that $$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \frac{1}{2} + \frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})} $$
Check $\theta$ and $n$ therein

A: Continue with
$$1 + e^{i\theta} + e^{2i\theta} + ... e^{ni\theta}=\frac{1 - e^{(n+1)i\theta}}{1 - e^{i\theta}}
=\frac{e^{\frac12(n+1)i\theta}}{e^{\frac12i\theta}}\cdot \frac{e^{-\frac12(n+1)i\theta} - e^{\frac12(n+1)i\theta}}{e^{-\frac12i\theta} - e^{\frac12i\theta}}
= e^{\frac12ni\theta} \frac{\sin\left(\frac{n + 1}2\theta\right)}{\sin(\frac{\theta}{2})}$$
Thus,
$$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = Re\left( e^{\frac12ni\theta}\frac{\sin\left(\frac{n + 1}2\theta\right)}{2\sin(\frac{\theta}{2})} \right) \\
\frac{\cos\left(\frac12n\theta\right)\sin[(n + \frac{1}{2})\theta]}{\sin(\frac{\theta}{2})}=\frac{\sin[(n + \frac{1}{2})\theta]+\sin(\frac{\theta}{2})}{2\sin(\frac{\theta}{2})}
=\frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})}+\frac12$$
Note that the term $\frac12$ is missing in the original expression.
A: Let $ n $ be a positive integer, we have the following :
\begin{aligned}\frac{\mathrm{e}^{\mathrm{i}\left(n+1\right)\theta}-1}{\mathrm{e}^{\mathrm{i}\theta}-1}&=\frac{\mathrm{e}^{\mathrm{i}\frac{n+1}{2}\theta}\left(\mathrm{e}^{\mathrm{i}\frac{n+1}{2}\theta}-\mathrm{e}^{-\mathrm{i}\frac{n+1}{2}\theta}\right)}{\mathrm{e}^{\mathrm{i}\frac{\theta}{2}}\left(\mathrm{e}^{\mathrm{i}\frac{\theta}{2}}-\mathrm{e}^{-\mathrm{i}\frac{\theta}{2}}\right)}\\&=\mathrm{e}^{\mathrm{i}\frac{n}{2}\theta}\frac{2\mathrm{i}\sin{\left(\frac{n+1}{2}\theta\right)}}{2\mathrm{i}\sin{\left(\frac{\theta}{2}\right)}}\\\frac{\mathrm{e}^{\mathrm{i}\left(n+1\right)\theta}-1}{\mathrm{e}^{\mathrm{i}\theta}-1}&=\mathrm{e}^{\mathrm{i}\frac{n}{2}\theta}\frac{\sin{\left(\frac{n+1}{2}\theta\right)}}{\sin{\left(\frac{\theta}{2}\right)}}\end{aligned}
