How do I integrate $4\int_0^{\pi/2}\frac{\sec^2(\theta)}{1+2\tan^2(\theta)}\,d\theta$ using symmetry? \begin{align}\int_{-\pi}^\pi \frac{1}{1+\sin^2(\theta)}\,d\theta&=4\int_0^{\pi/2} \frac{1}{1+\sin^2(\theta)}\,d\theta\\\\&=4\int_0^{\pi/2}\frac{\sec^2(\theta)}{1+2\tan^2(\theta)}\,d\theta\\\\&=\left.\left(\frac{\arctan(\sqrt 2 \tan(\theta))}{\sqrt2}\right)\right|_0^{\arctan\pi/2}\\\\&=\sqrt 2\pi\end{align}
I'm having a difficult time understanding how we get from the second to the third line. Apparently, some sort of symmetry is being used.
 A: U-substitution $u=\sqrt{2}\tan\theta$: 
$$
\int\frac{\sec^2\theta}{1+2\tan^2\theta}\,d\theta=
\frac{1}{\sqrt{2}}\int\frac{1}{1+(\sqrt{2}\tan\theta)^2}\frac{d}{d\theta}\left(\sqrt{2}\tan\theta\right)\,d\theta=\\
\frac{1}{\sqrt{2}}\int\frac{1}{1+u^2}\,du=\frac{1}{\sqrt{2}}\arctan{u}+C=\\
\frac{1}{\sqrt{2}}\arctan{(\sqrt{2}\tan\theta)}+C.
$$
If I'm understanding correctly, you're asking how they found the antiderivative of $\int\frac{\sec^2\theta}{1+2\tan^2\theta}\,dx$? That's lines 2 and 3. As far as symmetry is concerned, $f(\theta)=\frac{1}{1+\sin^2\theta}$ is an even function. Graph it and will see that you can integrate it from 0 to $\frac{\pi}{2}$ and quadruple the result.
I'm not sure why it is $\arctan{\pi/2}$ as the upper bound of integration there. That doesn't make much sense. This integral should be treated as an improper integral because $\frac{\sec^2\theta}{1+2\tan^2\theta}$ is not defined at $\frac{\pi}{2}$ (you multiplied the top and bottom by $\frac{1}{\cos^2\theta}$ and that's not defined at $\frac{\pi}{2}$). More specifically, you will jut not be able to plug in $\frac{\pi}{2}$ into the antiderivative because it contains the tangent function and the tangent of $\frac{\pi}{2}$ is not defined:
$$
4\int_{0}^{\frac{\pi}{2}}\frac{\sec^2\theta}{1+2\tan^2\theta}\,d\theta=
4\lim_{b\to\frac{\pi}{2}^-}\int_{0}^{b}\frac{\sec^2\theta}{1+2\tan^2\theta}\,d\theta=\\
\frac{4}{\sqrt{2}}\lim_{b\to\frac{\pi}{2}^-}\arctan{(\sqrt{2}\tan\theta)}\bigg|_{0}^{b}=
\frac{4}{\sqrt{2}}\lim_{b\to\frac{\pi}{2}^-}\left[\arctan{(\sqrt{2}\tan{b})}-\arctan{(\sqrt{2}\cdot 0)}\right]=\\
\frac{4}{\sqrt{2}}\left[\arctan{(+\infty)}-\arctan{(0)}\right]=
\frac{4}{\sqrt{2}}\left(\frac{\pi}{2}-0\right)=\\
\frac{4}{\sqrt{2}}\cdot\frac{\pi}{2}=
\frac{2\pi}{\sqrt{2}}=\frac{\sqrt{2}\cdot 2\pi}{\sqrt{2}\cdot\sqrt{2}}=
\frac{\sqrt{2}\cdot 2\pi}{2}=
\pi\sqrt{2}.
$$
