Show $1+\cosθ+\cos(2θ)+\cdots+\cos(nθ)=\frac{1}{2}+\frac{\sin[(n+1/2)θ]}{2\sin(θ/2)}$ Show 
$$1+\cosθ+\cos(2θ)+\cdots+\cos(nθ)=\frac12+\frac{\sin\left(\left(n+\frac12\right)θ\right)}{2\sin\left(\frac\theta2\right)}$$
I want to use De Moivre's formula and $$1+z+z^2+\cdots+z^n=\frac{z^{n+1}-1}{z-1}.$$  I set $z=x+yi$, but couldn't get it.

Here's a very simple solution that doesn't use complex numbers, just some basic trigonometric identities.  Recall that $$2 \cos \alpha \sin \beta = \sin(\alpha + \beta) - \sin(\alpha - \beta).$$  With the choice $\alpha = k \theta$, $\beta = \theta/2$, we then have $$2 \cos k\theta \sin \frac{\theta}{2} = \sin\bigl((k + {\textstyle \frac{1}{2}})\theta\bigr) - \sin\bigl((k - {\textstyle \frac{1}{2}})\theta\bigr).$$  Summing of both sides over $k = 0, 1, \ldots, n$ and observing that the RHS telescopes, $$\sum_{k=0}^n 2 \cos k\theta \sin \frac{\theta}{2} = \sin\bigl((n + {\textstyle \frac{1}{2}})\theta\bigr) - \sin\bigl(-{\textstyle \frac{1}{2}}\theta\bigr),$$ from which it immediately follows that $$\sum_{k=0}^n \cos k\theta = \frac{1}{2}\left( 1 + \frac{\sin((k+\frac{1}{2})\theta)}{\sin\frac{\theta}{2}}\right).$$
