<s>[INST] Definite integral of $\int_0^\pi \frac{d\theta}{a+\sin^2 \theta} \quad (a>0)$ Definite integral of $$\int_0^\pi \frac{d\theta}{a+\sin^2 \theta} \quad (a>0)$$
I was attempting to do a trig substitution but that did not work out for me I believe because of the $a$. Looking at this to begin with I thought it was going to go smoothly but I keep getting stuck.
 [/INST] If you don't mind contour integration, let $z=e^{i\theta}$:
$$
\begin{align}
\int_0^\pi\frac{\mathrm{d}\theta}{a+\sin^2(\theta)}
&=\frac12\int_0^{2\pi}\frac{\mathrm{d}\theta}{a+\sin^2(\theta)}\tag{1}\\
&=\frac12\oint_\gamma\frac1{a-\frac14\left(z-\frac1z\right)^2}\frac{\mathrm{d}z}{iz}\tag{2}\\
&=i\oint_\gamma\frac{2z\,\mathrm{d}z}{z^4-(2+4a)z^2+1}\tag{3}\\
&=i\oint_{\tilde\gamma}\frac{\mathrm{d}z}{z^2-(2+4a)z+1}\tag{4}\\
&=2i\oint_{\gamma}\frac{\mathrm{d}z}{(z-w_-)(z-w_+)}\tag{5}\\
&=-\frac{4\pi}{w_--w_+}\tag{6}\\[3pt]
&=\frac\pi{\sqrt{a+a^2}}\tag{7}
\end{align}
$$
Explanation:
$(1)$: integrand is $\pi$ periodic
$(2)$: $z=e^{i\theta}$ and $\gamma$ is a counter-clockwise unit circle
$(3)$: algebra
$(4)$: substitute $z^2\mapsto z$ but now $\tilde\gamma$ circles the origin twice
$(5)$: $w_+=1+2a+2\sqrt{a+a^2}$ and $w_-=1+2a-2\sqrt{a+a^2}$
$\phantom{(5)\text{:}}$ are the roots of $z^2-(2+4a)z+1$
$(6)$: $w_+$ is outside the unit circle
$\phantom{(6)\text{:}}$ the residue of $\frac1{(z-w_-)(z-w_+)}$ at $z=w_-$ is $\lim\limits_{z\to w_-}\frac{z-w_-}{(z-w_-)(z-w_+)}=\frac1{w_--w_+}$
$(7)$: evaluation

Alternatively, we can use the Weierstrass substitution.
$$
\begin{align}
\int_0^\pi\frac{\mathrm{d}\theta}{a+\sin^2(\theta)}
&=\int_0^\infty\frac{\frac{2\,\mathrm{d}t}{1+t^2}}{a+\left(\frac{2t}{1+t^2}\right)^2}\tag{8}\\
&=\int_0^\infty\frac{2\left(1+t^2\right)\mathrm{d}t}{a\left(1+t^2\right)^2+4t^2}\tag{9}\\
&=\int_0^\infty\frac{2\left(1+t^2\right)\mathrm{d}t}{at^4+(4+2a)t^2+a}\tag{10}\\
&=\frac2a\int_0^\infty\frac{\left(1+t^2\right)\mathrm{d}t}{(t^2+s_+^2)(t^2+s_{\vphantom{+}-}^2)}\tag{11}\\
&=\frac1{\sqrt{a+a^2}}\int_0^\infty\left(\frac{s_+}{t^2+s_+^2}+\frac{s_-}{t^2+s_{\vphantom{+}-}^2}\right)\mathrm{d}t\tag{12}\\
&=\frac1{\sqrt{a+a^2}}\left(\frac\pi2+\frac\pi2\right)\tag{13}\\
&=\frac\pi{\sqrt{a+a^2}}\tag{14}
\end{align}
$$
Explanation:
$\phantom{1}(8)$: Weierstrass substitution
$\phantom{1}(9)$: algebra
$(10)$: more algebra
$(11)$: factor the denominator with $s_+=\sqrt{1+\frac1a}+\sqrt{\frac1a}$ and $s_-=\sqrt{1+\frac1a}-\sqrt{\frac1a}$
$(12)$: partial fractions
$(13)$: arctangent integral
$(14)$: simplify
</s>