Simplified proof of Lemma 1.23
We want to show that
\[
1/2+\sum_{n=1}^N \cos(nu) =\begin{cases}
\frac{\sin\big((N+1/2)u\big)}{2\sin(u/2)} & u\ne 0,\\
N+\frac{1}{2} &u=0.\end{cases}.
\]
The $u=0$ case just follows by noticing that for $u=0$, the sum is
$\frac12 + 1+1+\cdots 1 = \frac12 +N$.
To establish the $u\ne 0$ case, we first note that $\cos(nu) =
\frac12\big(e^{inu}+e^{-inu}\big)$. It follows that
\[
1/2+\sum_{n=1}^N \cos(nu) = \frac12 + \sum_{n=1}^n
\frac{1}{2}\big(e^{inu}+e^{-inu}\big).
\]
Rewrite the sum on the right, starting with $e^{-iNu}$ going up to $e^{iNu}$:
\[
1/2+\sum_{n=1}^N \cos(nu) = \frac12(e^{-iNu} + e^{-(N-1)u} +\cdots+
e^{-iu}+1 +e^{iu} + \cdots + e^{iNu}).
\]
Multiple both sides above by $e^{iNu}$ and then use the identity
$1+z+\cdots +z^M = \frac{z^{M+1\,}\, - 1}{z-1}$, which holds for all $z\in
\mathbb C$, except $z=1$. The result is
\[ e^{iNu} \big(1/2+\sum_{n=1}^N \cos(nu)\big) = \frac12(1+e^{iu}
+e^{2iu} +\cdots+ e^{2iNu})=\frac12 \frac{e^{(2N+1)ui}-1}{e^{iu}-1} =
\frac12 \frac{e^{(N+1/2)iu}(e^{(N+1/2)iu} - e^{-(N+1/2)iu})}{e^{iu/2}(e^{iu/2}- e^{-iu/2})}.
\]
Now multiply both sides by $e^{-iNu}$ and manipulate the resulting
expression.
\[
1/2+\sum_{n=1}^N \cos(nu) = \frac12
\frac{2ie^{iu/2}\sin((N+1/2)u)}{2ie^{iu/2}\sin(u/2)}=
\frac{\sin((N+1/2)u)}{2\sin(u/2)},
\]
which is what we wanted to show.