<s>[INST] Tricky complex contour integration Show that $$\int_{0}^{2\pi} \frac{\cos^2{(\theta)}}{13-5\cos{(2\theta)}} \; d\theta = \frac{\pi}{10}$$ using complex contour integration.
I let $z = e^{i\theta}$ which means $dz = ie^{i\theta} \; d\theta = iz \; d\theta$ (meaning we know integrate over the unit circle $C$). Hence,
$$\int_{0}^{2\pi} \frac{\cos^2{(\theta)}}{13-5\cos{(2\theta)}} \; d\theta = \oint_{C} \frac{1/4\left(z+1/z\right)^2}{13-5/2\left(z^2+1/z^2\right)} \; \frac{dz}{iz} = -\frac{i}{2}\oint_{C}\frac{z(z^2+1)^2}{(z^3-5)(5z^3-1)} \; dz.$$ 
Not sure what to do next. Is it to find the poles that are in the unit circle? Thanks!!!
 [/INST] On the last step, you should have
$$I=\frac i2\oint_C\frac{(z^2+1)^2}{\color{red}z(z^{\color{red}2}-5)(5z^{\color{red}2}-1)}~\mathrm dz$$
Now use the two roots in the unit circle from $5z^2-1=0\Rightarrow z=\pm\sqrt5/5$ and $z=0$, which are first order poles, to get
$$I=\frac\pi{10}$$
</s>