Calculation of $\int_0^{\pi} \frac{\sin^2 x}{a^2+b^2-2ab \cos x}\mathrm dx$
We have $$\eqalign{I_m(a,b)= \int_0^\pi\frac{\cos(mx)}{a^2-2ab\cos x+b^2}\,\mathrm dx &=\left\{\matrix{\frac{\pi}{a^2-b^2}&\hbox{if}&m=0\\\cr \frac{\pi}{a^2-b^2}\left(\frac{b}{a}\right)^m&\hbox{if}&m\ne0 }\right.}$$ Proof can be seen here. Hence \begin{align} \int_0^{\pi} \frac{\sin^2 x}{a^2+b^2-2ab \cos x}\,\mathrm dx&=\frac{1}{2}\int_0^{\pi} \frac{1-\cos2 x}{a^2+b^2-2ab \cos x}\,\mathrm dx\\ &=\frac{1}{2}\left[\frac{\pi}{a^2-b^2}-\frac{\pi}{a^2-b^2}\left(\frac{b}{a}\right)^2\right]\\ &=\frac{\pi}{2 a^2} \end{align}
Such integral is related with the topological degree of a closed curve. We have:
$$ I = \frac{1}{2}\int_{0}^{2\pi}\frac{\sin^2 x}{\|a-be^{ix}\|^2}\,\mathrm dx = -\frac{i}{2}\oint_{\|z\|=1}\frac{\left(\frac{z-z^{-1}}{2}\right)^2}{(a-bz)(az-b)}\,\mathrm dz$$ hence we just have to consider the residues of the last integrand function in $z=0$ and $z=\dfrac{b}{a}$ (since $a>b>0$). That just leads to: $$ I = \frac{\pi}{2a^2}.$$