Originally Posted by

**Opalg** It pays to know your trig formulas! Use these:

$\displaystyle \sin\theta\sin\phi = \tfrac12\bigl(\cos(\theta-\phi) - \cos(\theta+\phi)\bigr),\qquad[1]$

$\displaystyle \cos2\theta = 1-2\sin^2\!\theta.\qquad[2]$

Then $\displaystyle =\frac{\sin^2 \!k\theta}{\sin\theta}+\sin (2k+1)\theta = \frac{\sin^2 \!k\theta+\sin (2k+1)\theta\sin\theta}{\sin\theta}$. The second term in the numerator is

$\displaystyle \tfrac12\bigl(\cos(2k\theta) - \cos(2k+2)\theta\bigr)$ by [1]

$\displaystyle = \sin^2(k+1)\theta - \sin^2\!k\theta$ by [2].