<s>[INST] Computation of a complex series I got stuck in a computation for hours and don't know where I did wrong. Let $N$ be a positive integer, I want to show the identity,
\begin{equation*}
 \sum_{n=1}^{N}e^{inx} = e^{ix}\frac{e^{iNx}-1}{e^{ix}-1} = e^{i\frac{1}{2}(N+1)x}\frac{\sin (\frac{1}{2}Nx)}{\sin (\frac{1}{2}x)}
\end{equation*}
Here's what I did, using $\sin{x} = \frac{e^{ix}-e^{-ix}}{2i}$, we have
\begin{align*}
   \frac{\sin [\frac{1}{2}Nx]}{\sin [\frac{1}{2}x]} &= \frac{e^{\frac{1}{2}Nix} -  e^{-\frac{1}{2}Nix}}{e^{\frac{1}{2}ix}- e^{-\frac{1}{2}ix}}\\
   & = \frac{e^{\frac{1}{2}(N+1)ix} -  e^{-\frac{1}{2}(N-1)ix}}{e^{ix}- 1}\\
   & = e^{-i\frac{1}{2}(N-1)x} \frac{  e^{iNx}-1}{e^{ix}- 1}
\end{align*}
But
\begin{equation*}
e^{ix} e^{-i\frac{1}{2}(N-1)x} = e^{i(\frac{3}{2}-\frac{N}{2})x}
\end{equation*}
where did this go wrong?
 [/INST] You didn't do anything wrong, just forgot to multiply by $e^{i\frac{1}{2}(N+1)x}$.
$$\begin{align*}
   \frac{\sin [\frac{1}{2}Nx]}{\sin [\frac{1}{2}x]} &= \frac{e^{\frac{1}{2}Nix} -  e^{-\frac{1}{2}Nix}}{e^{\frac{1}{2}ix}- e^{-\frac{1}{2}ix}}\\
   & = \frac{e^{\frac{1}{2}(N+1)ix} -  e^{-\frac{1}{2}(N-1)ix}}{e^{ix}- 1}\\
   & = e^{-i\frac{1}{2}(N-1)x} \frac{  e^{iNx}-1}{e^{ix}- 1}
\end{align*}$$
is correct and then to obtain the result you multiply by $e^{i\frac{1}{2}(N+1)x}$
to obtain $$e^{i\frac{1}{2}(N+1)x}\frac{\sin[\frac{1}{2}Nx]}{\sin[\frac{1}{2}x]}$$
$$=e^{i\frac{1}{2}(N+1-N+1)x}\frac{  e^{iNx}-1}{e^{ix}- 1}$$
$$=e^{ix}\frac{  e^{iNx}-1}{e^{ix}- 1}= \sum_{n=1}^{N}e^{inx}.$$
</s>