I have stated the sum of the sum of the series (by geometric series) which is $$S_n= \frac{z(1-z^n)}{1-z}$$
I am trying to prove the second part of the question. However, I am unable to reach to the form required. Here is what I have done,
$\cos\theta + \cos2\theta + ... + \cos n\theta = \sum Re(z^n)$. So,
$$\begin{align} Re\{S_n\} & = Re \{\frac{z(1-z^n)}{1-z}\} \\ & = Re \{\frac{z^{\frac{1}{2}}-z^{n+\frac{1}{2}}}{z^{-\frac{1} {2}}+z^\frac{1}{2}}\} \\ & = Re \{\frac{z^{\frac{1}{2}}-z^{n+\frac{1}{2}}}{-2isin\frac{1}{2}\theta}\}\\ & = Re \{\frac{\cos\frac{1}{2}\theta + i\sin\frac{1}{2}\theta - \cos(n+\frac{1}{2})\theta - i\sin(n+\frac{1}{2})\theta}{-2i\sin\frac{1}{2}\theta}\}\\ & = Re \{\frac{\cos(n+\frac{1}{2})\theta - \cos\frac{1}{2}\theta + i\sin(n+\frac{1}{2})\theta - i\sin\frac{1}{2}\theta }{2i\sin\frac{1}{2}\theta}\}\\ & = Re \{\frac{-i\sin\frac{1}{2}\theta (\cos(n+\frac{1}{2})\theta) -i\sin\frac{1}{2}\theta(\cos\frac{1}{2}\theta) + \sin\frac{1}{2}\theta \sin(n+\frac{1}{2})\theta - \sin(\frac{1}{2})^2\theta }{2\sin\frac{1}{2}\theta}\}\\ & = \frac{\sin\frac{1}{2}\theta \sin(n+\frac{1}{2})\theta - \sin(\frac{1}{2})^2\theta }{2\sin\frac{1}{2}\theta}\\ & = \frac{ \sin(n+\frac{1}{2})\theta - \sin(\frac{1}{2})\theta }{2}\\ & = \frac{ \sin(n\theta)\cos\frac{1}{2}\theta + \cos(n\theta)\sin\frac{1}{2}\theta - \sin(\frac{1}{2})\theta }{2}\\ \end{align}$$
I have corrected my mistake at the answers section.
What was wrong: I multiplied the numerator with $ i\sin\frac{1}{2}\theta$ when it could have just been $i$. I have done the correction below.
$$\begin{align} Re\{S_n\} & = Re \{\frac{z(1-z^n)}{1-z}\} \\ & ...\\ & = Re \{\frac{\cos(n+\frac{1}{2})\theta - \cos\frac{1}{2}\theta + i\sin(n+\frac{1}{2})\theta - i\sin\frac{1}{2}\theta }{2i\sin\frac{1}{2}\theta}\}\\ & = Re \{\frac{-i(\cos(n+\frac{1}{2})\theta) -i(\cos\frac{1}{2}\theta) + \sin(n+\frac{1}{2})\theta - \sin(\frac{1}{2})\theta }{2\sin\frac{1}{2}\theta}\}\\ & = \frac{ \sin(n+\frac{1}{2})\theta - \sin(\frac{1}{2})\theta }{2\sin\frac{1}{2}\theta}\\ & = \frac{ \sin(n\theta)\cos\frac{1}{2}\theta + \cos(n\theta)\sin\frac{1}{2}\theta - \sin\frac{1}{2}\theta }{2\sin\frac{1}{2}\theta}\\ & = \frac{ 2\sin(\frac{1}{2}n\theta)\cos(\frac{1}{2}n)\theta\cos\frac{1}{2}\theta + (1 - 2\sin^2(\frac{1}{2}n\theta))\sin\frac{1}{2}\theta - \sin\frac{1}{2}\theta }{2\sin\frac{1}{2}\theta}\\ & = \frac{ 2\sin(\frac{1}{2}n\theta)\cdot(\cos(\frac{1}{2}n\theta )\cos\frac{1}{2}\theta + \sin(\frac{1}{2}n\theta)\sin\frac{1}{2}\theta) }{2\sin\frac{1}{2}\theta}\\ & = \frac{ \sin(\frac{1}{2}n\theta)\cdot\cos\frac{1}{2}(n+1)\theta }{\sin\frac{1}{2}\theta}\\ \end{align}$$