<s>[INST] Cauchy's Integral Formula, Evaluate Evaluate,
$$            
\oint_{C}\frac{\cos2z}{z^{2}(z^{2}-z+1)}dz
$$
where $C$ is the circle of radius $2$ centred at the origin. Answer should be in the format $J=A\cos(2z+)+B\cos(2z-)+C$.
Really would appreciate if someone could show me how to do this. I was able to find the singularities but I have never come across when all the singularities are in the unit circle. 
The singularities I got were $z=0$, $z=(1\pm i\sqrt3)/2$.
Any help is welcome, Thanks!
 [/INST] If you want to apply the Cauchy integral formula directly, you'll need to use partial fraction decomposition:
$$
\frac{1}{z^2(z^2-z+1)}=\frac{1}{z^2}\left(z+1-\frac{z^3}{z^2-z+1}\right)
=\frac{1}{z}+\frac{1}{z^2}-\frac{z}{z^2-z+1}
$$
Let $a=e^{\frac{\pi i}{3}}=\frac{1+i\sqrt{3}}{2}$. Then
\begin{align}
\frac{z}{z^2-z+1}&=\frac{1}{3}\left(\frac{3z-(\overline{a}-a)-(a-\overline{a})}{z^2-z+1}\right)\\&=
\frac{1}{3}\left(\frac{2z+2z\Re a-(\overline{a}+\overline{a}^2)-(a+a^2)}{z^2-z+1}\right)\\&=
\frac{1}{3}\left(\frac{2z+z(a+\overline{a})-\overline{a}(1+\overline{a})-a(1+a)}{(z-a)(z-\overline{a})}\right)\\&=
\frac{1}{3}\left(\frac{z(1+a)+z(1+\overline{a})-\overline{a}(1+\overline{a})-a(1+a)}{(z-a)(z-\overline{a})}\right)\\&=
\frac{1}{3}\left(\frac{1+\overline{a}}{z-a}+\frac{1+a}{z-\overline{a}}\right)
\end{align}
Thus the contour integral we are interested in is
$$
\oint_C\cos 2z\left(\frac{1}{z}+\frac{1}{z^2}-\frac{1+\overline{a}}{3(z-a)}-\frac{1+a}{3(z-\overline{a})}\right)dz=I_1+I_2+I_3+I_4
$$
Let $f(z)=\cos 2z$ and $g(z)=\sin 2z$, so that $f(z)=\frac{1}{2}g'(z)$. Note that each of $0,a,\overline{a}$ is in the interior of $C$, which justifies our use of the Cauchy integral formula.
The first integral is
$$
I_1=\oint_C\frac{\cos 2z}{z}dz=\oint_C\frac{f(z)}{z-0}dz=2\pi i f(0)=2\pi i
$$
The second is
$$
I_2=\oint_C\frac{\cos 2z}{z^2}dz=\frac{1}{2}\oint_C\frac{g'(z)}{(z-0)^2}dz=\frac{1}{2}\frac{2\pi i}{1!}g(0)=0
$$
The third is
$$
I_3=-\frac{1+\overline{a}}{3}\oint_C\frac{f(z)}{z-a}dz=-\frac{1+\overline{a}}{3}\cdot 2\pi if(a)
$$
The fourth is
$$
I_4=-\frac{1+a}{3}\oint_C\frac{f(z)}{z-\overline{a}}dz=-\frac{1+a}{3}\cdot 2\pi if(\overline{a})
$$
Finally the total contour integral is
$$
I_1+I_2+I_3+I_4=2\pi i\left(1-\frac{1+\overline{a}}{3}\cos(2a)-\frac{1+a}{3}\cos(2\overline{a})\right)
$$
which you can simplify somewhat if you like.
</s>