Computing an integral where the poles of the integrand are the roots of unity I am trying to compute the following integral: $$\int_0^{2\pi} \frac{y}{y^n-1} dy$$
I've tried to decompose $y^n-1$ into $(y-1)(y-e^{i\theta})(y-e^{i2\theta})...(y-e^{i(n-1)\theta})$ but I don't know what to do with this factorization. I've read some others similar questions with the answers but I don't know if the same methods apply.
 A: Let $ f(z) = \frac{z}{z^n - 1} $. You're looking for $ \oint_{\gamma} f(z) dz $ taken over a contour that is outside of the unit circle, loosely speaking. We will use the Residue Theorem to compute the integral. Define $ \omega_k = e^{2 \pi i k / n} $ for $ k = 0, \dots, n-1 $ to be the roots of unity, which are also the poles of $ f(z) $. We calculate the residues using the factorization $ z^n - 1 = \prod_{k=0}^{n-1} (z-\omega_k) $ as follows:
$$ R_k = \lim_{z\to \omega_k} (z-\omega_k)f(z) =  \omega_k \prod_{j \ne k} (\omega_k - \omega_j)^{-1} = \omega_k \prod_{l = 1}^{n-1} \left[ \omega_k^{-1} ( 1 - \omega_l)^{-1} \right] = \omega_k^2 R_0 .$$
Note that the above uses $ \omega_k^{-n} = 1 $ and the index substitution $ l = j-k $. We could use the geometric formula to calculate $ R_0 = 1/(n-1) $, but it's actually unnecessary because we know that $ \sum \omega_k^2 = 0 $ (for $ n > 2 $), since it is the $ z^2 $ coefficient of the polynomial $ z^n-1 $. Hence the integral vanishes.
A: Hint: Let $\xi_k, k=1,2,\ldots,n,$ be any one of the zeros of $z^n-a$, and $f(z)=1/(z^n-a)$, so $\xi_k$ is a simple pole of $f(z)$ (assuming that $a\neq0$). Then by l'Hospital
$$
Res(f(z),\xi_k)=\lim_{z\to\xi_k}\frac{z-\xi_k}{z^n-a}=
\lim_{z\to\xi_k}\frac{1}{nz^{n-1}}=\frac{1}{n\xi_k^{n-1}}=\frac{\xi_k}{n\xi_k^n}=\frac{\xi_k}{na}.
$$
