Verify that $\int_0^{\frac{\pi}{2}}\frac{d\theta}{a+\sin^2\theta}=\frac{\pi}{2[(a(a+1)]^\frac{1}{2}}$
I know that $\sin\theta=\frac{e^{i\theta}-e^{-i\theta}}{2}$ then I did $$\int_0^{\frac{\pi}{2}}\frac{d\theta}{a+\sin^2\theta}=\int_0^{\frac{\pi}{2}}\frac{d\theta}{a+\frac{1}{4}(e^{i\theta}-e^{-i\theta})^2}=\int_0^{\frac{\pi}{2}}\frac{4d\theta}{4a+(e^{i\theta}-e^{-i\theta})^2}$$
I do not know if this is right but I'm really stuck
NOTE 1:
NOTE 2:
SIMPLIFYING THE INTEGRAL
Using the identity $(1)$, the integral of interest $I\equiv \int_0^{\pi/2}\frac{1}{a+\sin^2x}dx$ simplifies to
$$\begin{align} I&\equiv \int_0^{\pi/2}\frac{1}{a+\sin^2x}dx\\\\ &=\int_0^{\pi/2}\frac{2}{(2a+1)-\cos 2x}dx\\\\ &=\int_0^{\pi}\frac{1}{(2a+1)-\cos x}dx\\\\ &=\frac12\int_0^{2 \pi}\frac{1}{(2a+1)-\cos x}dx \end{align}$$
COMPLEX-PLANE ANALYSIS
Now, we will move to the complex plane. Let $C$ be the unit circle $|z|=1$ in the complex plane. Then, let $z=e^{ix}$ so that $dz=ie^{ix}dx$, and $\cos x = \frac12 (z+z^{-1})$. This gives
$$\begin{align} I&=\frac12 \oint_C \frac{1}{(2a+1)-\frac12(z+z^{-1})}\frac{dz}{iz}\\\\ &=i \oint_C \frac{1}{z^2-2(2a+1)z+1}dz \end{align}$$
The roots of $z^2-2(2a+1)+1=0$ are $z=(2a+1)\pm 2\sqrt{a(a+1)}$. If $a>0$, then the root $(2a+1)-2\sqrt{a(a+1)}<1$ and the root $(2a+1)+2\sqrt{a(a+1)}>1$. If $a<-1$, then $(2a+1)+2\sqrt{a(a+1)}<1$ and $(2a+1)-2\sqrt{a(a+1)}>1$.
CASE 1:
For $a>0$, the residue of $i \frac{1}{z^2-2(2a+1)z+1}$ is given by
$$\text{Res}\left(i \frac{1}{z^2-2(2a+1)z+1},z=(2a+1)-2\sqrt{a(a+1)}\right)=i\frac{1}{-4\sqrt{a(a+1)}}$$
and the value of the integral $I$ is
$$\bbox[5px,border:2px solid #C0A000]{I=\int_0^{\pi/2}\frac{1}{a+\sin^2x}dx=\frac{\pi}{2\sqrt{a(a+1)}}}$$
as expected!
CASE 2:
For $a<-1$, the residue of $i \frac{1}{z^2-2(2a+1)z+1}$ is given by
$$\text{Res}\left(i \frac{1}{z^2-2(2a+1)z+1},z=(2a+1)+2\sqrt{a(a+1)}\right)=i\frac{1}{4\sqrt{a(a+1)}}$$
and the value of the integral $I$ is
$$\bbox[5px,border:2px solid #C0A000]{I=\int_0^{\pi/2}\frac{1}{a+\sin^2x}dx=-\frac{\pi}{2\sqrt{a(a+1)}}}$$