I cannot figure out what I'm doing wrong:
$$\int_0^{2\pi} \frac{1}{a+b\sin\theta} d\theta\quad a>b>0$$
$$\int_{|z|=1} \frac{1}{a+\frac{b}{2i}(z-z^{-1})} \frac{dz}{iz}$$
$$\int_{|z|=1} \frac{2i}{2ia+b(z-z^{-1})} \frac{dz}{iz}$$
$$\int_{|z|=1} \frac{2}{2iza+bz^2-b} dz$$
$$2iz_0a+bz_0^2-b=0$$
$$z_0=\frac{-2ia\pm\sqrt{-4^2+4b^2}}{2b}$$
$$z_0=\frac{a\pm\sqrt{a^2 - b^2}}{bi}$$
where only $z_0=\frac{a-\sqrt{a^2 - b^2}}{bi}$ is within $C$.
So $Res(z_0) = \frac{-2b}{-2\sqrt{a^2-b^2}}$
So the integral is $\frac{2\pi bi}{\sqrt{a^2-b^2}}$
But this is wrong. The $bi$ should not be there. However I cannot see what I'm missing here? I also checked $Res(0)$ for order 1 and it was equal to $0$.
The integral $I=\int_0^{2\pi}\frac{1}{a+b\sin \theta}\,d\theta$ is simply $2\pi i$ times $2/b$ times the residue of $z^2+i 2(a/b) z-1$ at $z=i\left(-\frac ab +\sqrt{(a/b)^2-1}\right)$. Thus, we have
$$I=(2\pi i)\frac2b \frac{1}{2i\sqrt{(a/b)^2-1}}=\frac{2\pi}{\sqrt{a^2-b^2}}$$