Finding integral using Residue Thm Trying to Find $\displaystyle \int_{\gamma}\frac{dz}{(z-3)(z^n-1)}$ where $\gamma$ is the circle at origin with radius 2.
So I know $\displaystyle \int_{\gamma}\frac{dz}{(z-3)(z^n-1)}=2\pi i (res(f,3)+\sum_{p \text{ root of unity} } res(f,p))$
I did find that first part $res(f,3)$ is $\frac{1}{3^n-1}$ but I have no idea on how to approach the second part. Can someone help me on this with details?
Thanks!

The Residue Theorem tells you that the integral of $f$ along a simple closed curve equals $2\pi i$ times the sum of residues at points inside that curve. So you have to get rid of $\text{Res}(f,3)$, since $3$ lies outside the circle $\gamma$.
On the other hand, finding the residues at the roots of unity would be very tedious. Instead, consider
$$\frac{1}{z^2}f\left(\frac{1}{z}\right)=\frac{z^{n-1}}{(1-3z)(1-z^n)},$$
and show that $\text{Res}(f,\infty)=0$. Since the sum of all residues is zero, it follows that
$$\sum_{p\text{ roots of unity}}\text{Res}(f,p)=-\text{Res}(f,3).$$
Therefore, the integral becomes
$$\int_\gamma \frac{dz}{(z-3)(z^n-1)}=-2\pi i\text{Res}(f,3).$$
