Prove that $\frac{1}{2\pi i}\int_\mathcal{C} |1+z+z^2+\cdots+z^{2n}|^2~dz =2n$ where $\mathcal{C}$ is the unit circle On the generalization of a recent question, I have shown, by analytic and numerical means, that
$$\frac{1}{2\pi i}\int_\mathcal{C} |1+z+z^2+\cdots+z^{2n}|^2~dz =2n$$
where $\mathcal{C}$ is the unit circle. Thus, $z=e^{i\theta}$ and $dz=iz~d\theta$. There remains to prove it, however.
What I have done: consider the absolute value part of the integrand,
$$
\begin{align}
|1+z+z^2+\cdots+z^{2n}|^2
&=(1+z+z^2+\cdots+z^{2n})(1+z+z^2+\cdots+z^{2n})^*\\
&=(1+z+z^2+\cdots+z^{2n})(1+z^{-1}+z^{-2}+\cdots+z^{-2n})\\
&=(1+z+z^2+\cdots+z^{2n})(1+z^{-1}+z^{-2}+\cdots+z^{-2n})\frac{z^{2n}}{z^{2n}}\\
&=\left(\frac{1+z+z^2+\cdots+z^{2n}}{z^n} \right)^2\\
&=\left(\frac{1}{z^n}\cdots+\frac{1}{z}+1+z+\cdots z^n \right)^2\\
&=(1+2\cos\theta+2\cos 2\theta+\cdots+2\cos n\theta)^2\\
\end{align}
$$
We now return to the integral,
$$
\begin{align}\frac{1}{2\pi i}\int_C |1+z+z^2+\cdots z^n|^2dz
&=\frac{1}{2\pi}\int_0^{2\pi}(1+2\cos\theta+2\cos 2\theta+\cdots+2\cos n\theta)^2 (\cos\theta+i\sin\theta)~d\theta\\
&=\frac{1}{2\pi}\int_0^{2\pi}(1+2\cos\theta+2\cos 2\theta+\cdots+2\cos n\theta)^2 \cos\theta~d\theta
\end{align}$$
where we note that the sine terms integrate to zero by virtue of symmetry. This is where my trouble begins. Clearly, expanding the square becomes horrendous as $n$ increases, and even though most of the terms will integrate to zero, I haven't been able to selectively find the ones that won't.
The other thing I tried was to simplify the integrand by expressing it in terms of $\cos\theta$ only using the identity
$$\cos n\theta=2\cos (n-1)\theta\cos\theta-\cos(n-2)\theta$$
but this too unfolds as an algebraic jungle very quickly. There are various other expressions for $\cos n\theta$, but they seem equally unsuited to the task. I'll present them here insofar as you may find them more helpful than I did.
$$
\cos(nx)=\cos^n(x)\sum_{j=0,2,4}^{n\text{ or }n-1} (-1)^{n/2}\begin{pmatrix}n\\j\end{pmatrix}\cot^j(x)=\text{T}_n\{\cos(x)\}\\
\cos(nx)=2^{n-1}\prod_{j=0}^{n-1}\cos\left(x+\frac{(1-n+2j)\pi}{2n} \right)\quad n=1,2,3,\dots
$$
where $\text{T}_n$ are the Chebyshev polynomials. Any suggestions will be appreciated.
 A: First of all
$$
\int_{|z|=1}\overline{z}\,dz=\int_{|z|=1}\frac{dz}{z}=2\pi i,
$$
since $z\overline{z}=1$. Meanwhile, for $k>1$ 
$$
\int_{|z|=1}\overline{z}^k\,dz=\int_{|z|=1}\frac{dz}{z^k}=0.
$$
Now, when $|z|=1$, we have $\overline{z}=z^{-1}$ and hence
$$
|1+z+\cdots+z^{2n}|^2=(1+z+\cdots+z^{2n})(1+\overline{z}+\cdots+\overline{z}^{2n})=\sum_{j,k=0}^{2n}z^k\overline{z}^j
=\sum_{j=-4n}^{4n} c_jz^j
$$
In the above sum, the term $c_{-1}$ is equal to exactly $2n$, and it is the only term which survives after the integration along the unit circle. Finally
$$
\int_{|z|=1}|1+z+\cdots+z^{2n}|^2\,dz=\int_{|z|=1}\frac{c_{-1}\,dz}{z}=2\pi i c_{-1}=2\pi i\cdot 2n.
$$
A: For $z\in\mathcal C$, we have $$|1+...+z^{2n}|^2 = (1+z+...+z^{2n})(1+z^{-1}+...+z^{-2n}) = \sum_{j=0}^{2n}\sum_{k=0}^{2n}z^jz^{-k} = \sum_{j=0}^{2n}\sum_{k=0}^{2n}z^{j-k}.$$
Therefore $$\frac{1}{2\pi i}\int_{\mathcal C}|1+z+...+z^{2n}|^2 dz = \sum_{j=0}^{2n}\sum_{k=0}^{2n}\frac{1}{2\pi i}\int_{\mathcal C}z^{j-k}dz.$$
If $j-k\neq -1$, this integral vanishes, so you just have to count the summands for which $j-k=-1$ and calculate $\frac{1}{2\pi i}\int_{\mathcal C}z^{-1}dz$.
A: You can simplify things as follows. We have:
$$f(z) = \sum_{k=0}^{2n}z^k = \frac{z^{2n+1}-1}{z-1}$$
Then on the unit circle, we have:
$$\left|f(z)\right|^2 = f(z)f^*(z) =  f(z)f(z^*) = f(z)f\left(z^{-1}\right) =  \frac{\left(z^{2n+1}-1\right)^2}{z^{2n}(z-1)^2}$$
The integral over the unit circle is then given by the coefficient of $z^{2n-1}$ of $\dfrac{\left(z^{2n+1}-1\right)^2}{(z-1)^2}$ which is the same as the coefficient of $z^{2n-1}$ in $\dfrac{1}{(z-1)^2}$, we can get this from differentiating the geometric series, which yields the result of $2n$.
A: $$
\frac{1}{2\pi i}\int_0^{2\pi}\sum_{l=0}^{2n}e^{il\theta}\sum_{m=0}^{2n}e^{-im\theta}ie^{i\theta}d\theta=\frac{1}{2\pi}\sum_{l,m=0}^{2n}\int_0^{2\pi}\exp(i\theta(l-m+1))d\theta
$$
I think the last integral is zero unless $l-m+1=0$, which happens $2n$ times when $l$ and $m$ go between 0 and 2n. 
