Integrating $z^{2n}\cos(1/z)/(1-z^n)$ over a circle of radius $2$ around the origin I'm stuck on the following integral computation: 
$$\int_C \frac{z^{2n} \cos (1/z)}{1 - z^n} \, dz,$$ 
where $C$ is a circle of radius $2$ around the origin. 
I tried making the substitution $u = 1/z$, and then using the residue theorem to find the value of the resulting integral. However, this was very messy. Is this a correct method and is there another way of computing the value of this integral? 
Thanks. 
 A: 
I tried making the substitution $u = 1/z$, and then using the residue theorem to find the value of the resulting integral.

Good. That's the best way that I see.

However, this was very messy.

That means you took a wrong turn at some point. (I assume that $n > 0$, for $n < 0$ the computation is similar.)
$$\begin{align}
\int_{\lvert z\rvert = 2} \frac{z^{2n} \cos \frac{1}{z}}{1-z^n}\,dz
&= \int_{\lvert w\rvert = \frac{1}{2}} \frac{w^{-2n}\cos w}{1-w^{-n}}\frac{dw}{w^2}\\
&= \int_{\lvert w\rvert = \frac{1}{2}} \frac{\cos w}{w^{n+2}(w^n-1)}\,dw\\
&= 2\pi i \operatorname{Res} \left(\frac{\cos w}{w^{n+2}(w^n-1)}; 0\right).
\end{align}$$
Now it remains to find the residue. If $n$ is even, the function is even, and hence the residue is $0$. For odd $n$, we expand $\frac{1}{w^n-1}$ into a geometric series,
$$\frac{\cos w}{w^{n+1}(w^n-1)} = - \frac{\cos w}{w^{n+2}}\left(1 + w^n + w^{2n} + w^{3n} + \dotsc\right).$$
If $n \geqslant 3$, then the terms for $w^{kn}$ with $k \geqslant 2$ cannot contribute to the residue because $kn > n+2$. The term for $w^n$ never contributes to the residue because $w^n\cos w = w^n - \frac{w^{n+2}}{2} + \dotsc$ has no term with $w^{n+1}$. Thus for odd $n \geqslant 3$, the residue is the resdiue of $-\frac{\cos w}{w^{n+2}}$, which is $\frac{(-1)^{(n-1)/2}}{(n+1)!}$. For $n = 1$, we have
$$-\frac{\cos w}{w^3}(1+w+w^2+\dotsc) = -w^{-3}\left(1-\frac{w^2}{2} + \dotsc\right)(1+w+w^2+\dotsc) = -w^{-3}(1 + w + \frac{w^2}{2} + \dotsc)$$
and the residue is $-\frac{1}{2}$.
A: Polynomial $1-z^n$ has $n$ different roots in form $\displaystyle e^{\frac{2\pi k}{n}}$ for $k=0,1,\cdots,n-1$. Next you now that $\displaystyle |e^{\frac{2\pi k}{n}}|=1$, so roots lare inside the circle. For each root use residue theorem (each one is single pole):
$$Res_{e^{\frac{2\pi k}{n}}}f(z)=\lim_{z \to e^{\frac{2\pi k}{n}}}\frac{z^{2n} \cos (1/z)}{1 - z^n}(z-e^{\frac{2\pi k}{n}})$$
To calculate this limit use formula $a^n-b^n=(a-b)(a^{n-1}+a^{n-2}b+\cdots+ab^{n-2}+b^{n-1})$.
