$$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})} $$
Using De moivre's theorem you arrived that
$$ \operatorname{Re}(1 + e^{i\theta} + e^{2i\theta} + ... e^{ni\theta}) = \operatorname{Re} \biggl(\frac{1 - e^{(n+1)i\theta}}{1 - e^{i\theta}}\biggr)$$
Now will reverse-engineer the process back to trigonomety using
$$e^{ix} = \cos(x)+i\sin(x)$$
$$\operatorname{Re} \biggl( \frac{ 1 -( \cos{(n+1)\theta}+i\sin{(n+1)\theta} )}{ 1 - ( \cos{\theta}+i\sin{\theta} ) }\biggr)$$
$$\frac{ 1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta}}{ 1 - \cos{\theta}- i\sin{\theta} }$$
We would now multiply the numerator and the denominator by the conjugate of the denominator $1 - \cos{\theta} + i\sin{\theta}$
$$\frac{ 1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta} }{ 1 - \cos{\theta}- i\sin{\theta} }\cdot\frac{1 - \cos{\theta} + i\sin{\theta}}{1 - \cos{\theta} + i\sin{\theta}}$$
$$\frac{ (1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta})\cdot(1 - \cos{\theta} + i\sin{\theta} )}{ (1 - \cos{\theta}- i\sin{\theta})\cdot(1 - \cos{\theta} + i\sin{\theta}) }$$
$$\frac{ (1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta})\cdot(1 - \cos{\theta} + i\sin{\theta} )}{ (1 - \cos{\theta} )^2 - (i\sin{\theta})^2 }$$
Now since the denominator is off imaginary number, it's easy to equate $\mathbb{R}$
$$\frac{ (1 - \cos{(n+1)\theta}-i\sin{(n+1)\theta})\cdot(1 - \cos{\theta} + i\sin{\theta} )}{ (1 - \cos{\theta} )^2 + (\sin{\theta})^2 }$$
$$\frac{ (\sin{\theta}*\sin{(n+1)\theta}+\cos{\theta}*\cos{(n+1)\theta}-\cos{(n+1)\theta}-\cos{\theta}+1) + i\cdot(\cos{\theta}*\sin{(n+1)\theta}-\sin{(n+1)\theta}-\sin{\theta}*\cos{(n+1)\theta}+\sin{\theta}) }{ (1 - \cos{\theta} )^2 + (\sin{\theta})^2 }$$
so when we take away imaginary the expression becomes
$$\frac{ (\sin{\theta}*\sin{(n+1)\theta}+\cos{\theta}*\cos{(n+1)\theta}-\cos{(n+1)\theta}-\cos{\theta}+1) }{ (1 - \cos{\theta} )^2 + (\sin{\theta})^2 }$$
let's simplify further
$$\frac{-1\cos{(n+1)\theta}+\cos{n\theta}-\cos{\theta}+1 }{ 1-2\cos{\theta}+(\cos{\theta} )^2 + (\sin{\theta})^2 }$$
$$\frac{ -1\cos{(n+1)\theta}+\cos{n\theta}-\cos{\theta}+1 }{ 2 -2\cos{\theta} }$$
We still simplify further to reduce this
it turns out that $- H = \frac{1}{2} + \frac{\sin{(n+\frac{1}{2})\theta} }{2\sin{\frac{\theta}{2}}}$, and there was no mistake in my calculations
$$H = \frac{ -1\cos{(n+1)\theta}+\cos{n\theta}-\cos{\theta}+1 }{ 2 -2\cos{\theta} }$$
Proof of error, remember $$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})} $$, say $n=1$
But $$ 1+\cos{\theta} ≠ \frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})}$$, for every $\theta$ it doesn't turn out to be equal because it is with a displacement of $\frac{1}{2}$
So that $$ 1 + \cos \theta + \cos2\theta + ... + \cos n\theta = \frac{1}{2} + \frac{\sin[(n + \frac{1}{2})\theta]}{2\sin(\frac{\theta}{2})} $$
Check $\theta$ and $n$ therein