Definite integral $\int_0^{2\pi}(\cos^2(x)+a^2)^{-1}dx$ How do I prove the following?
$$ I(a)=\int_0^{2\pi} \frac{\mathrm{d}x}{\cos^2(x)+a^2}=\frac{2\pi}{a\sqrt{a^2+1}}$$

If anyone wants to see a complex analysis solution.
Let $\gamma$ be the unit$\require{autoload-all}$ circle. This proof holds for all complex $a$ such that the integral exists.
$$ I(a)=\int_0^{2\pi}\!\!\! \frac{\mathrm{d}t}{\cos^2(t)+a^2}$$
$$
\toggle{ 
\text{Set} \; x = e^{it}\quad\enclose{roundedbox}{\text{ Click for Information }}
}{
\begin{align}
 x &= e^{it}\\
\sin(t) &= \frac{1}{2i}\left(x-\frac{1}{x}\right)\\
\cos(t) &=\frac{1}{2}\left(x+\frac{1}{x}\right)\\
\mathrm{d}t &= \frac{-i \, \mathrm{d}x}{x}
\end{align}
}\endtoggle
$$
$$\begin{align} I(a)&=\int_\gamma \frac{-i\,\mathrm{d}x}{x\frac{x^4+2x^2+4x^2a^2+2}{4x^2}} \\[.2cm] &=\int_\gamma \frac{-4ix\,\mathrm{d}x}{x^4+2x^2+4x^2a^2+2} \end{align}$$
The zeros of the denominator are
$$x= \pm\sqrt{-2 a^2-2\sqrt{a^2} \sqrt{a^2+1}-1},\quad x =  \pm\sqrt{-2 a^2+2\sqrt{a^2}\sqrt{a^2+1}-1}$$
Only the second two roots will be inside the unit circle. Call these roots $x_+$ and $x_-$ and set $\alpha = x_+^2$.
$$I(a) = 2\pi i \left(\lim_{x\to x_+} \frac{-4ix(x-x_+)}{x^4+2x^2+4x^2a^2+2} + \lim_{x\to x_-} \frac{-4ix(x-x_-)}{x^4+2x^2+4x^2a^2+2}\right)$$
Factor out constants and apply L'Hopitals rule for both of the limits
$$\begin{align}I(a) &= 8\pi \left(\lim_{x\to x_+} \frac{2x-x_+}{4x^3+4x+8xa^2} + \lim_{x\to x_-} \frac{2x-x_-}{4x^3+4x+8xa^2}\right)\\ 
&= 8\pi \left(\frac{x_+}{4x_+^3+4x_++8x_+a^2} + \frac{x_-}{4x_-^3+4x_-+8x_-a^2}\right) \\ 
&=8\pi \left(\frac{1}{4x_+^2+4+8a^2} + \frac{1}{4x_-^2+4+8a^2}\right)\end{align}$$
Using the fact that $x_+^2 = x_-^2=\alpha$
$$\begin{align} I(a) &= 4\pi \left(\frac{1}{\alpha+1+2a^2}\right) \\ &= \frac{4\pi}{(-2 a^2+2\sqrt{a^2}\sqrt{a^2+1}-1)+1+2a^2} \\ &= \frac{2\pi}{\sqrt{a^2}\sqrt{a^2+1}}\end{align}$$
This is the result for $a \in \mathbb{C}$. For $a \in \mathbb{R}$ we can say that
$$I(a)=\int_0^{2\pi}\!\!\! \frac{\mathrm{d}t}{\cos^2(t)+a^2} = \frac{2\pi}{a\sqrt{a^2+1}}$$
