Identity involving trigonometric sum I have to prove that $$\overset{N}{\underset{n=-N}{\sum}}
 \left(N-\left|n\right|\right)e^{2\pi inx}=\left|\overset{N}{\underset{n=1}{\sum}}
 e^{2\pi inx}\right|^{2}=\left(\frac{\sin\left(N\pi x\right)}{\sin\left(\pi x\right)}\right)^{2}$$ with $x\notin\mathbb{Z}$ and $N \in \mathbb{N}$. I tried by induction but I haven't come up with a proof yet.
 A: HINT: From the geometrical sequence, you know that
$$
\sum_{n=0}^Nq^n =\frac{1-q^{N+1}}{1-q}, \quad q\neq 1. \tag1
$$
By differentiating with respect to $q$
$$
\sum_{n=0}^Nnq^{n-1} =\partial_q \left(\frac{1-q^{N+1}}{1-q}\right), \quad q\neq 1. \tag2
$$
Then apply it with $q=e^{2i\pi x}$, observing that $\displaystyle \sum_{n=-N}^N=\sum_{n=-N}^{-1}+\sum_{n=0}^N$.
A: For the second equality, you can use the formula for a geometric sum:
$$
\sum_{n=0}^N q^n = \frac{1-q^{N+1}}{1-q}.
$$
In this case, $q=e^{2\pi i x}$, so you get (notice that the zeroth term $e^{2\pi i 0 x}=1$ is missing from the sum)
$$
\sum_{n=1}^N e^{2\pi i n x} = \frac{1- e^{2\pi i (N+1) x}}{1-e^{2\pi i x}} - 1 = \frac{e^{2\pi i x} - e^{2\pi i (N+1) x}}{1-e^{2\pi i x}} = e^{2\pi i x} \frac{ 1 - e^{2\pi i N x}}{1-e^{2\pi i x}}.
$$
Now that we are interested in the absolute value, we can ignore the factor $2^{2\pi i x}$ and use $|z|^2=z\overline{z}$ for the numerator or denominator. 
Or if we want to be clever and avoid some work, we can notice that multiplying these by $e^{i\varphi}$ where $\varphi$ is real does not change the absolute value. Thus:
$$
\left| e^{2\pi i x} \frac{ 1 - e^{2\pi i N x}}{1-e^{2\pi i x}} \right| =  \frac{\left| 1 - e^{2\pi i N x} \right|}{\left| 1-e^{2\pi i x} \right|}  =  \frac{\left| e^{-\pi i N x} - e^{\pi i N x} \right|}{\left| e^{-\pi i x}-e^{\pi i x} \right|} = \frac{\left|2i\sin(\pi N x)\right|}{\left|2i\sin(\pi x)\right|} = \left| \frac{\sin(\pi N x)}{\sin(\pi x)} \right|.
$$
After squaring, the RHS does not need absolute value, because it is real.
