How do I evaluate this integral using cauchy's residue theorem. $$\int_0^{2\pi} \dfrac{\cos 2 \theta}{1+\sin^2 \theta}d\theta$$
$$=\dfrac{-2}{i}\oint_{|z|=1} \dfrac{z^4+1}{z(z^4-4z^2-2z+1)}dz $$
I am stuck on how to use Cauchy's residue theorem since the bottom does not factor nicely. I know $z=-1$, $z=0.3111$ and $z=0$ lie within the contour but not sure where to go from here.

Using trig. identities and eulers formula and long division:
$$
 \int_0^{2 \pi} \dfrac{ \cos 2 \theta}{1+\sin^2 \theta} d \theta=\int_0^{2 \pi} \dfrac{ \cos 2 \theta}{1+\frac{1}{2}(1-\cos 2\theta)}$$
 $$=2\int_0^{2 \pi} \dfrac{ \cos 2 \theta}{3-\cos 2\theta}$$
 $$= 2 \int_0^{2 \pi} - d\theta + 6\int_0^{2\pi}\dfrac{d \theta}{3- \cos 2\theta}$$
 $$-4\pi +\dfrac{12}{i}\oint_{|z|=1}\dfrac{zdz}{(-z^4+6z^2-1)}$$
 $$-4 \pi +\dfrac{12}{i}\oint_{|z|=1}\dfrac{zdz}{(z-1-\sqrt{2})(z+1+\sqrt{2})(z-\sqrt{2}+1)(z+\sqrt{2}-1)}$$
 $$=-4 \pi +24\pi Res(f;\sqrt{2}-1)+24 \pi Res(f;-\sqrt{2}+1) $$
 $$-4\pi + \frac{3}{2}\sqrt{2}\pi+\frac{3}{2} \sqrt{2} \pi $$
 $$\pi(3\sqrt{2}-4)$$
This what I was looking for. I'm not sure if this is correct or not but it did match one of the answers.
