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.
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. $$