Integral of $\frac{\sin^2(nx/2)}{\sin^2(x/2)}$ over $[-\pi,\pi]$. I would like to show that
$$\frac{1}{n\pi}\int_{-\pi}^\pi \frac{\sin^2(nx/2)}{2\sin^2(x/2)} dx = 1$$
My attempt is very similar to the accepted answer to  this question.
$$\int_{-\pi}^\pi \frac{\sin^2(nx/2)}{2\sin^2(x/2)} dx = \frac{1}{2} \int_{-\pi}^\pi {1-\cos(n x)\over 1-\cos(x)}dx$$
I have $\int_{-\pi}^{\pi}{1-\cos(n x)\over 1-\cos(x)}dx$, then 
$$\cos\bigl((n+1)x\bigr)+\cos\bigl((n-1)x\bigr)=2\cos x\, \cos(nx)\ ,$$
that gives
$$1-\cos\bigl((n+1)x\bigr)=2(1-\cos x)\cos(nx)+ 2\bigl(1-\cos(nx)\bigr)-\bigl(1-\cos((n-1)x\bigr)\ .$$
Except $$\int_{-\pi}^{\pi}\cos(nx)\ dx= \frac{1}{n} \sin(n\pi) \ne 0$$ does not go away.
So I do not get the right conclusion in the recursion at the end. Where is my mistake?
 A: We have:
$$ \frac{\sin(nz)}{\sin z} = \frac{e^{inz}-e^{-inz}}{e^{iz}-e^{-iz}}=\frac{e^{iz}}{e^{inz}}\cdot\frac{e^{2niz}-1}{e^{2iz}-1}=e^{-(n-1)iz}\sum_{k=0}^{n-1}e^{2kiz}$$
so:
$$\frac{\sin(nx/2)}{\sin(x/2)}=e^{-\frac{n-1}{2}iz}\sum_{k=0}^{n-1}e^{kix}$$
and:
$$\left(\frac{\sin(nx/2)}{\sin(x/2)}\right)^2 = e^{-(n-1)iz}\sum_{j,k=0}^{n-1}e^{(k+j)ix}$$
so:
$$\int_{-\pi}^{\pi}\left(\frac{\sin(nx/2)}{\sin(x/2)}\right)^2\,dx = 2\pi\cdot\#\{(j,k)\in[0,n-1]^2: j+k=n-1\}$$
and the claim:

$$\int_{-\pi}^{\pi}\left(\frac{\sin(nx/2)}{\sin(x/2)}\right)^2\,dx = 2\pi n$$

follows.
A: By some simple manipulations you can use what was shown in the related question:
$$
\int_{-\pi}^\pi {\sin^2(nx)\over \sin^2(x)} = 2 n \pi \tag{1}
$$
So we want to use $(1)$ to evaluate your integral. Note that by using $ u \mapsto x/2$ one has
$$
\int_{-\pi}^\pi \frac{\sin^2(nx/2)}{2\sin^2(x/2)}\,\mathrm{d}x
=\int_{-\pi/2}^{\pi/2} \frac{\sin^2(n u)}{\sin^2(u)}\,\mathrm{d}u \tag{2}
$$
It can be trivially shown that
$$
\int_0^{\pi/2} \sin nx \,\mathrm{d}x = \frac 12 \int_0^{\pi} \sin nx \,\mathrm{d}x  \tag{3}
$$
Just evaluate both sides. Using $(3)$, equation $(2)$ can be written as 
$$
\int_{-\pi}^\pi \frac{\sin^2(nx/2)}{2\sin^2(x/2)}\,\mathrm{d}x
= \int_{-\pi/2}^{\pi/2} \frac{\sin^2(n u)}{\sin^2(u)}\,\mathrm{d}u
= \frac{1}{2}\int_{-\pi}^{\pi} \frac{\sin^2(n u)}{\sin^2(u)}\,\mathrm{d}u
= n \pi 
$$
As wanted
