Finding an expression for sum of sin and cos series

The question asks to show for $$0<\theta<2\pi:$$ $$\operatorname{Re}\left(\frac{1-e^{i(n+1)\theta}}{1-e^{i\theta}}\right) = \frac{1}{2} + \frac{\sin(n+\frac{1}{2})\theta}{2\sin\frac{\theta}{2}}$$ $$\operatorname{Im}\left(\frac{1-e^{i(n+1)\theta}}{1-e^{i\theta}}\right) = \frac{\cot\frac{\theta}{2}}{2} + \frac{\cos(n+\frac{1}{2})\theta}{2\sin\frac{\theta}{2}}$$

and to use these results to find $$C=1+\cos\theta+\cos2\theta+\cdots+\cos n\theta$$ and $$S=\sin\theta+\sin2\theta+\cdots+\sin n\theta$$

I've done the first two parts by multiplying the expression top and bottom by $$e^{-i\frac{\theta}{2}}$$ but I'm having trouble seeing how I can use the results to find expressions for $C$ and $S$. Any tips would be appreciated, thanks!

• In fact the first equations are the "difficult" part of the problem, and the rest the easy. Try to think $\dfrac{1-x^n}{1-x}$... Factorisation of $(1-x^n)$ is key here. – Martigan Mar 14 '16 at 16:05

Hint:$$C+iS=\sum_{k=0}^n \cos(k\theta)+i\sin(k\theta)=\sum_{k=0}^n e^{ik\theta}=\cdots$$