Integrate $\int_0^ {2\pi} \frac{sin^2\theta} {2 - cos\theta} d\theta $
I used the substitutions sin($\theta$) = $\frac{ z - z^{-1}}{2i} $ and cos($\theta$) = $\frac{ z + z^{-1}}{2} $ and d$\theta$ = $\frac{1}{iz}dz$ transforming the integral into $\frac{-i}{2} \oint \frac{1}{z^2}\frac{(z-1)^2}{z^2-4z+1}dz$ leaving me at the point where I am stuck.
The function has period $2\pi$, so $I=\int\limits_0^{2\pi}\frac{\sin^2x\, dx}{2-\cos x}=\int\limits_{-\pi}^{\pi}\frac{\sin^2x\, dx}{2-\cos x}$,
also it is even function, so $I=2\int\limits_{0}^{\pi}\frac{\sin^2x\, dx}{2-\cos x}$. Now take $t=\tan\frac{x}2$