Cauchy Residue Theorem Integral I have been given the integral $$\int_0^ {2\pi} \frac{sin^2\theta} {2 - cos\theta} d\theta $$ I have use the substitutions $z=e^{i\theta}$ |$d\theta = \frac{1}{iz}dz$ and a lot of algebra to transform the integral into this $$\frac{-i}{2} \oint \frac{1}{z^2}\frac{(z-1)^2}{z^2-4z+1}dz$$ In order to find the residues i further broke the integral into $$\frac{-i}{2} \oint \frac{1}{z^2}\frac{(z-1)^2}{(z+-r_1)(z-r_2)}dz$$ where $r_1 = 2+\sqrt{3}$ and $r_2 = 2-\sqrt{3}$ giving me three residues at $z=0|z=r_1|z=r_2 $ 
My question is where do I go from here? Thanks.
 A: There was an error in the original post. We have
$$\int_0^{2\pi}\frac{\sin^2(\theta)}{2-\cos(\theta)}d\theta=-\frac i2\oint_{|z|=1}\frac{(z^2-1)^2}{z^2(z^2-4z+1)}\,dz$$
There are two poles inside $|z|=1$.  The first is a second order pole at $z=0$ and the second is a first order pole at $z=r_2$.  
To find the reside of the first pole we use the general expression for the residue of a pole of order $n$
$$\text{Res}\{f(z), z= z_0\}=\frac{1}{(n-1)!}\lim_{z\to z_0}\left(\frac{d^{n-1}}{dz^{n-1}}\left((z-z_0)^nf(z)\right)\right)$$
Here, we have
$$\begin{align}
\text{Res}\left(\frac{-i(z^2-1)^2}{2z^2(z^2-4z+1)}, z= 0\right)&=\frac{1}{(2-1)!}\lim_{z\to 0}\left(\frac{d^{2-1}}{dz^{2-1}}\left((z-0)^2\frac{-i(z^2-1)^2}{2z^2(z^2-4z+1)}\right)\right)\\\\
\end{align}$$
To find the residue at $z=r_2$ we have simply
$$\text{Res}\left(\frac{-i(z^2-1)^2}{2z^2(z^2-4z+1)}, z= r_2\right)=\lim_{z\to r_2}\frac{-i(z^2-1)^2}{2z^2(z-r_1)}=-\frac{i}{2}\frac{(r_2^2-1)^2}{r_2^2(r_2-r_1)}$$
The rest is left as an exercise for the reader.
