<s>[INST] Evaluation of $\int_0^{2\pi} \frac{1}{1+8\cos^2(\theta)}d\theta$ with Cauchy's residue Theorem I have to proof 
 $$\int_0^{2\pi} \frac{1}{1+8\cos^2(\theta)}d\theta = \frac{2\pi}{3}$$
with Cauchy's residue Theorem. I have showed it, but in my solution, there comes $-\frac{2\pi}{3}$. I Show you my solution:
I know that $\cos(\theta)=\frac{1}{2}(z+z^{-1})$, while $z=e^{i\theta}$, and $\frac{dz}{dt}=iz$, so $dt=\frac{dz}{iz}$. Let $C$ be an unit circle. Now, I Substitute and get:
\begin{align*}
\int_0^{2\pi} \frac{1}{1+8\cos^2(\theta)}d\theta &= \int_C \frac{1}{1+8(\frac{1}{2}(z+\frac{1}{z}))^2}\frac{dz}{iz} = \int_C \frac{1}{1+2(z+\frac{1}{z})^2}\frac{dz}{iz} \\
&= \int_C \frac{-i}{z+2z(z+\frac{1}{z})^2}dz = -i\int_C \frac{1}{z+2z(z+\frac{1}{z})^2}dz \\
&= -i\int_C \frac{1}{z+2z(z^2+2+z^{-2})}dz = -i\int_C \frac{1}{z+2z^3+4z+2z^{-1}}dz \\
&= -i\int_C \frac{1}{2z^3+5z+2z^{-1}}dz = -i\int_C \frac{z}{2z^4+5z^2+2}dz \\
&= -i\int_C \frac{z\cdot dz}{(z^2+2)(2z^2+1)} \\
&=-i\int_C \frac{z~dz}{(z+i\sqrt{2})(z-i\sqrt{2})(z+\frac{i}{\sqrt{2}})(z-\frac{i}{\sqrt{2}})}
\end{align*}
The singularities to be considered are at $2^{-1/2}i, -2^{1/2}i$. Let $C_1$ be a small circle about $2^{-1/2}i$, $C_2$ a small circle about $-2^{-1/2}i$.
Then I put it together:
\begin{align*}
&\Rightarrow -i\left[\oint_{C_1}\frac{z\left(\frac{1}{(z+i\sqrt{2})(z-i\sqrt{2})(z+\frac{i}{\sqrt{2}})}\right)}{z-\frac{i}{\sqrt{2}}} + \oint_{C_2}\frac{z\left(\frac{1}{(z+i\sqrt{2})(z-i\sqrt{2})(z-\frac{i}{\sqrt{2}})}\right)}{z+\frac{i}{\sqrt{2}}} \right] \\
&= -i\left.\left[2\pi i\left(\frac{z}{(z+\sqrt{2}i)(z-\sqrt{2}i)(z+\frac{i}{\sqrt{2}})} \right)\right|_{z=\frac{i}{\sqrt{2}}} +\left. 2\pi i\left(\frac{z}{(z+\sqrt{2}i)(z-\sqrt{2}i)(z-\frac{i}{\sqrt{2}})} \right)\right|_{z=-\frac{i}{\sqrt{2}}} \right] \\
&= 2\pi \left[ \frac{i/\sqrt{2}}{(\frac{3i}{\sqrt{2}})(\frac{-i}{\sqrt{2}})(\frac{2i}{\sqrt{2}})} + \frac{-i/\sqrt{2}}{(-\frac{3i}{\sqrt{2}})(\frac{i}{\sqrt{2}})(-\frac{2i}{\sqrt{2}})}\right] \\
&= 2\pi \left( \frac{1}{\sqrt{2}(+3)\sqrt{2}}+\frac{1}{\sqrt{2}(+3)\sqrt{2}}\right) \\
&= 2\pi \cdot \frac{+1}{3} = \frac{2\pi}{3}.
\end{align*}
 [/INST] It is better to notice that, by replacing $\theta$ with $\arctan t$:
$$ I = 4\int_{0}^{\pi/2}\frac{d\theta}{1+8\cos^2\theta} = 4\int_{0}^{+\infty}\frac{dt}{(1+t^2)(1+\frac{8}{1+t^2})}=2\int_{-\infty}^{+\infty}\frac{dt}{9+t^2}$$
and the last integral is very easy to compute with the residue theorem, or without:
$$2\int_{-\infty}^{+\infty}\frac{dt}{t^2+9}=\frac{2}{3}\int_{-\infty}^{+\infty}\frac{du}{u^2+1}=\frac{2\pi}{3}.$$
</s>