Complex analysis integral (maybe using residue theory?) Trying to compute the following integral:
$$
\int_{-\pi}^{\pi} \frac{d\theta}{1+\sin^2(\theta)}.
$$
This is for a complex analysis course, so I'm trying to find a way to use residue theory of something of that nature to solve the problem. I can't think of a substitution that will easily allow me to use residue theory.

You can solve the integral also without the help of complex analysis. For instance
\begin{align*}
\int\dfrac{1}{1+\sin^2(x)}\, dx &= \int\dfrac{1}{1+\sin^2(x)}\dfrac{\frac{1}{\sin^2(x)}}{\frac{1}{\sin^2(x)}} \ dx \\
&=\int\dfrac{\frac{1}{\sin^2(x)}}{\frac{1}{\sin^2(x)}+1}\, dx \\
&=\int\dfrac{\frac{1}{\sin^2(x)}}{2+\cot^2(x)}\, dx,\qquad \text{since }\dfrac{1}{\sin^2(x)}=1+\dfrac{\cos^2(x)}{\sin^2(x)} \\
&=\int\dfrac{\frac{1}{\sin^2(x)}}{2+u^2}\cdot \left(-\sin^2(x)\right)\, du,\qquad u=\cot(u), du = -\dfrac{1}{\sin^2(x)}dx\\
&=-\int\dfrac{1}{2+u^2}\, du \\
&=-\frac12\int\dfrac{1}{(\frac{u^2}{2}+1)}\, du \\
&=-\frac{1}{\sqrt{2}}\int\dfrac{1}{s^2+1}\,ds, \qquad s=\frac{u}{\sqrt{2}},ds = \frac{du}{\sqrt{2}}\\
&=-\frac{1}{\sqrt{2}}\arctan\left(\dfrac{\cot(x)}{\sqrt{2}}\right)=:f(x)
\end{align*}
And evaluating $f(x)$ from $-\pi$ to $\pi$ gives you $\sqrt{2}\pi$.
