How did they get from line 4 to 5?
$\sin{(n+1)\theta} \cdot \cos{n\theta} - \cos{(n+1)\theta} \cdot \sin{n\theta} = \sin{((n+1)\theta-n\theta)}$
How did they get from line 4 to 5?
$\sin{(n+1)\theta} \cdot \cos{n\theta} - \cos{(n+1)\theta} \cdot \sin{n\theta} = \sin{((n+1)\theta-n\theta)}$
For giggles, here's the scenic route:
Start with
$\sin{(n+1)\theta} \cdot \cos{n\theta} - \cos{(n+1)\theta} \cdot \sin{n\theta}$
and then use the addition formulae:
$\begin{align*}\sin(n+1)\theta&=\sin\,n\theta\cos\,\theta+\cos\,n\theta\sin\,\theta\\\cos(n+1)\theta&=\cos\,n\theta\cos\,\theta-\sin\,n\theta\sin\,\theta\end{align*}$
to yield
$(\sin\,n\theta\cos\,\theta+\cos\,n\theta\sin\,\theta)\cos{n\theta} - (\cos\,n\theta\cos\,\theta-\sin\,n\theta\sin\,\theta)\sin{n\theta}$
after which,
$\begin{align*} &\color{red}{(\sin\,n\theta\cos\,n\theta\cos\,\theta+\cos^2 n\theta\sin\,\theta)} - \color{blue}{(\cos\,n\theta\sin\,n\theta\cos\,\theta-\sin^2 n\theta\sin\,\theta)}\\ &\color{red}{\sin\,n\theta\cos\,n\theta\cos\,\theta}-\color{blue}{\cos\,n\theta\sin\,n\theta\cos\,\theta}+\color{red}{\cos^2 n\theta\sin\,\theta}+\color{blue}{\sin^2 n\theta\sin\,\theta}\\ &(\color{red}{\cos^2 n\theta}+\color{blue}{\sin^2 n\theta})\color{purple}{\sin\,\theta}\\ &\color{purple}{\sin\,\theta} \end{align*}$
As $J.M.$ has said, one should use the standard trigonometric identities about sums and differences of two variables $a$ and $b$ in a sine of cosine function. In fact whenever you see expressions like that it is very useful to know the following formulas, which I always remember as:
$\sin (a \pm b) = \sin a \cos b \pm \cos a \sin b,$
$\cos (a \pm b) = \cos a \cos b \mp \sin a \sin b$.
If you use the first of the two (the one about $\sin (a - b)$) as J.M. suggested by substituting in $a = (n+1) \theta$, $b = n \theta$, your answer pops out immediately. A little bit more about their usefulness:
Sometimes say you have an inner product space of finite dimension, say $W$ that is the span of $\{1, \cos x, \sin x\}$. If I asked you to calculate the projection of the function $\cos(x - \alpha)$, $\alpha \in [0, \pi]$ onto the subspace $W$ with respect to the inner product $\langle, \rangle$ given by
$\langle f(x), g(x) \rangle = \int_{-\pi/2}^{\pi/2} f(x)g(x) dx$,
you would need to evaluate things like say $\int_{-\pi/2}^{\pi/2} \cos x \cos (x - \alpha) dx$. Now the formulas I told you of above will come very handy in evaluating this integral.