In a proof of $\sum_{k=0}^n\cos(k\theta)=\frac{1}{2}+\frac{\sin[(n+\frac{1}{2})\theta]}{2\sin(\theta/2)}$
I need help figuring out the identity used to simplify from red $ \color{red}{1}$ to $\color{red}{2}$ in this proof:
Also where did the negative sign between red 1 and i come from? Please note that I do not want a proof of the formula as this has already many answers on stackexchange and I don't want the question to be marked as duplicate and closed before my question gets answered. The sum here for instance starts w/ $\cos(1\theta)$ so using Olivier's final answer and the identity $\sin(\theta)\cos(\phi)=\frac{\sin(\theta+\phi)+\sin(\theta-\phi)}{2}$ + 1 is one way.