TITLE: Integral $\int_0^\infty \frac{x^n - 2x + 1}{x^{2n} - 1} \mathrm{d}x=0$
QUESTION [18 upvotes]: Inspired by some of the greats on this site, I've been trying to improve my residue skills. I've come across the integral
$$\int_0^\infty \frac{x^n - 2x + 1}{x^{2n} - 1} \mathrm{d}x=0$$
where $n$ is a positive integer that is at least $2$.
With non-complex methods, I know that the integral is $0$. But I know that it can be done with residue theorem.
The trouble comes in choosing a contour. We're probably going to do some pie-slice contour, perhaps small enough to avoid any of the $2n$th roots of unity, and it's clear that the outer-circle vanishes. But I'm having trouble getting the cancellation for the integral.
Can you help? (Also, do you have a book reference for collections of calculations of integrals with the residue theorem that might have similar examples?)

REPLY [5 votes]: Just in case someone wonders how it can be done the "normal" way, here it is.
By factorization what we are trying to prove is:
$$
\int_0^\infty \frac{1}{x^n-1} dx = 2 \int_0^\infty \frac{x}{x^{2n}-1} dx
$$
On the right hand side let $x \rightarrow \sqrt{t}$.