Solution (source code)

= Solution

First use $\sin\theta/(a-\sin\theta)=a/(a-\sin\theta)-1$. If $J=\int_{-\pi}^{\pi}(a-\sin\theta)^{-1}\,d\theta$, the required integral is $aJ-2\pi$.

Set $z=e^{i\theta}$. The <unit circle> is traversed counterclockwise once, $d\theta=dz/(iz)$, and $\sin\theta=(z-z^{-1})/(2i)$. Thus
$$
J=\frac1i\oint_{|z|=1}\frac{h(z)}z\,dz.
$$
The function $h(z)/z=-2i/(z^2-2iaz-1)$ is regular at zero. Its only enclosed <pole> is $z_-$ from part (b), and its <residue> is
$$
\operatorname{Res}_{z=z_-}\frac{h(z)}z=\frac1{z_-}\operatorname{Res}_{z=z_-}h=\frac1\Delta.
$$
By the <residue theorem>, $J=(1/i)2\pi i/\Delta=2\pi/\Delta$. Therefore
$$
\boxed{\int_{-\pi}^{\pi}\frac{\sin\theta}{a-\sin\theta}\,d\theta=2\pi\left(\frac{a}{\sqrt{a^2-1}}-1\right).}
$$
As a sign and scale check, this is positive and behaves as $\pi/a^2$ for large $a$, in agreement with expanding the integrand and integrating its first nonzero, $\sin^2\theta/a^2$, term.