Evaluate $\int_0^{2\pi}\frac{\sin^2(x)}{a + b\cos(x)}\ dx$ using a suitable contour I need to find a good contour for $\int_0^{2\pi}\frac{\sin^2(x)}{a + b\cos(x)}\ dx$ but I don't know which one to choose. Both a semicircular, and rectangular contour look ugly for this. 
I've been looking at a semicircular contour of radius $2\pi$, but then I have the problem that I don't know whether the singularity is inside or outside the closed region. 
If it helps, the answer is $\frac{2\pi}{b^2}\left[a - \sqrt{a^2 - b^2}\right]$ 
 A: 
Note that the integral diverges for $a\le b$.  Therefore, we assume throughout the development that $a>b$.

We can simplify the task by rewriting the integrand as
$$\begin{align}
\frac{\sin^2(x)}{a+b\cos(x)}&=\frac{a}{b^2}-\frac{1}{b}\cos(x)-\left(\frac{a^2-b^2}{b^2}\right)\frac{1}{a+b\cos(x)}
\end{align}$$
Then, the integral of interest reduces to 
$$\int_0^{2\pi}\frac{\sin^2(x)}{a+b\cos(x)}\,dx=\frac{2\pi a}{b^2}-\frac{a^2-b^2}{b^2}\int_0^{2\pi}\frac{1}{a+b\cos(x)}\,dx \tag 1$$
We enforce the substitution $z=e^{i x}$ in the integral on the right-hand side of $(1)$ and obtain
$$\begin{align}
\int_0^{2\pi}\frac{1}{a+b\cos(x)}\,dx& =\oint_{|z|=1}\frac{1}{a+b\left(\frac{z+z^{-1}}{2}\right)}\frac{1}{iz}\,dz\\\\
&=\frac2{ib}\oint_{|z|=1}\frac{1}{(z+(a/b)-\sqrt{(a/b)^2-1})(z+(a/b)+\sqrt{(a/b)^2-1})}\,dz\\\\
&=2\pi i \frac2{ib} \frac{1}{2\sqrt{(a/b)^2-1}}\\\\
&=\frac{2\pi}{\sqrt{a^2-b^2}}
\end{align}$$
Putting it all together, the integral of interest is
$$\bbox[5px,border:2px solid #C0A000]{\int_0^{2\pi}\frac{\sin^2(x)}{a+b\cos(x)}\,dx=\frac{2\pi}{b^2}\left(a-\sqrt{a^2-b^2}\right)}$$
as was to be shown!
