Trigonometric integral using residues I am trying to evaluate following integral by using the Residue Theorem: 
$$\int_0^{2\pi}\frac{\cos^2x}{13+12\cos x}dx.$$
Then $\cos x=\frac{z^2+1}{2z}$, $dx=\frac{dz}{iz}$ and we have  $f(z)=\frac{(z^2+1)^2}{2z+3}$, $$\int_\gamma\frac{f(z)}{z^2(3z+2)}dz$$
The poles $z=0,\frac{-2}{3}$ are inside $\gamma=\{z\in C:|z|=1\}$, but I can't partition off simple fractions.
 A: Your reduction of the real integral to the complex one is correct
$$\int_0^{2\pi}\frac{\cos^2 x}{13+12\cos x}dx=\frac{1}{4i}\int_{|z|=1}f(z)dz
=\frac{\pi}{2}\left(\text{Res}(f,0)+\text{Res}\left(f,-\frac{2}{3}\right)\right)$$
where $\displaystyle f(z)=\frac{(z^2+1)^2}{z^2(2z+3)(3z+2)}$.
Now by the partial fraction decomposition there are constant $A,B,C,D,E$ such that $$f(3z+2z)=\frac{A}{z}+\frac{B}{z^2}+\frac{C}{2z+3}+\frac{D}{3z+2}+E.$$ You need to find $A$ and $D$.
Instead of looking for the partial fraction decomposition of $f$ why don't you compute the residues directly? 
Take a look at Calculating residues. Then 
1) For the residue at $-2/3$, which is a simple pole, consider the limit
$\lim_{z\to -2/3}(z+2/3)f(z)$.
2) For the residue at $z=0$, whose order is two, you may use the  limit formula for higher order poles or just note that
$$\frac{(z^2+1)^2}{(2z+3)(3z+2)}=\frac{1+2z^2+z^4}{6(1+\frac{2z}{3})(1+\frac{3z}{2})}=\frac{1}{6}\left(1-\frac{2z}{3}-\frac{3z}{2}+o(z)\right).$$
Can you take it from here?
