Evaluate using Residues $\int_0^{2\pi}\frac{d\theta}{1+a\sin\theta}$ I need to evaluate the following using residues: $\int_0^{2\pi}\frac{d\theta}{1+a\sin\theta}$ where $-1<\theta<1$.
I suppose the $a$ in front of $\sin\theta$ is throwing me off.  I was thinking I could let $z=e^{i\theta}$ and so $\sin\theta=\frac{z-z^{-1}}{2i}$ and $dz=izd\theta$.  So, the integral becomes: $\int_{|z|=1}\frac{dz}{iz(1+a(\frac{z-z^{-1}}{2i}))}$.  After some, hopefully mistake-free, algebra, we'd get:
$2\int_{|z|=1}\frac{dz}{az^2+2iz-a}$.  Now, we can use the quadratic formula (again, hopefully mistake-free) to get $z=\frac{-i\pm\sqrt{-1-a^2}}{a}$.
From here, I'm not really sure where to go.  Do I just plug and chug and find residues using these two poles, or is there something sneaky going on?  Or, did I make a mistake somewhere earlier?
Any help is appreciated :)  Thank you.

Use $$\int_{0}^{a} f(x) dx=\int_{0}^{a} f(a-x) dx$$
So $$I=\int_{0}^{2\pi} \frac{dx}{1+a\sin x}~~~~(1)$$
$$\implies I=\int_{0}^{2\pi} \frac{dx}{1-a\sin x}~~~~(2)$$
Adding (12) and (2), nxt using  $\int_{0}^{2a} f(x) dx= 2 \int_{0}^{a} f(x) dx$ if $f(2a-x)=f(x)$
$$I=\int_{0}^{2\pi} \frac{~dx}{1-a^2 \sin^2 x}=4\int_{0}^{\pi/2} \frac{dx}{(1-a^2)\sin^2 x+\cos^2 x}=4\int_{0}^{\pi/2} \frac{\sec^2 x dx}{1+(1-a^2)\tan^2x}$$
$$\implies I=\frac{4}{b^2}\int_{0}^{\infty} \frac{dt}{1/b^2+t^2}=\frac{4}{b} \tan^{-1} bt|_{0}^{\infty}=\frac{2\pi}{ b}=\frac{2 \pi}{\sqrt{1-a^2}}, ~if~ a^2<1.$$
