Residue theorem for line segment I am working through this problem:- Show that $\int_0^ \infty \frac{1}{1+x^n} dx= \frac{ \pi /n}{\sin(\pi /n)}$ , where $n$ is a positive integer.
I follow it all, except for part (3) - I think this must a technique I haven't encountered yet, why does the integral on the incoming ray tend to $ -e^{\frac{2 \pi i}{n}} \int_{0}^{\infty}\frac{dx}{1+x^n} $ ?
I tried - because the function is analytic, it is path independent - $ \lim_{{R}\to{\infty}}  \int_{R}^{0}f(z)dz = f(0) - f(R) $. Not promising.
What I can sort of see, might be to paramerterize $ z= Re^{\frac{2 \pi i}{n}}, dz=e^{\frac{2 \pi i}{n}}dR $
and then find $ \lim_{{R}\to{\infty}} e^{\frac{2 \pi i}{n}} \int_{0}^{R}\frac{dR}{1+R^ne^{2 \pi i}}$ but thats no better than the original problem.  A hint on the approach would be very helpful, thanks
 A: It might be instructive just to walk through the entire process. So, to that end here we go.
First, we note on the closed contour $C$, we can parameterize the three connected contours $C_1$, $C_2$, and $C_3$ as follows:
On $C_1$, we are on the real axis and have $z=t$ and $dz=dt$, where $t$ starts at $0$ and ends at $R$.
On $C_2$, we are on a circular arc with $z=Re^{it}$ and $dz=iRe^{it}dt$, where $t$ starts at $0$ and ends at $2\pi/n$.
On $C_3$, we are on a straight line segment with $z=e^{i2\pi/n}\,t$ and $dz=e^{i2\pi/n}\,dt$, where $t$ starts at $R$ and ends at $0$.

Now that we have our parameterizations, let's proceed to evaluate the integral contributions to each.  First, as $R\to \infty$ the contribution to the closed contour integral from the integration over the circular arc $C_2$ vanishes.  To see this, we write 
$$\begin{align}
\left|\int_0^{2\pi/n}\frac{1}{1+R^ne^{int}}iRe^{it}dt\right|&\le\int_0^{2\pi/n}\frac{1}{|1+R^ne^{int}|}Rdt\\\\
&\le\int_0^{2\pi/n}\frac{1}{R^n-1}Rdt\\\\
&= \frac{2\pi}{n}\frac{R}{R^n-1}\\\\
&\to 0
\end{align}$$
as $R\to \infty$, for integer $n>1$.

Having evaluated the integral over $C_2$ as zero, we must have that the sum of the contributions of integrations over $C_1$ and $C_3$ must equal $2\pi i$ times the residue of the function $\frac{1}{1+z^n}$ at the single enclosed pole at $z=e^{i\pi/n}$.  Therefore, we have that 
$$\begin{align}
\int_0^{\infty}\frac{1}{1+t^n}dt+\int_{\infty}^{0}\frac{1}{1+t^n}e^{i2\pi/n}dt&=(1-e^{i2\pi/n})\int_0^{\infty}\frac{1}{1+x^n}\,dx\\\\
&=2\pi i \text{Res}\left(\frac{1}{1+z^n},z=e^{i\pi/n}\right)
\end{align}$$
The residue from the single enclosed pole is given by
$$\begin{align}
\text{Res}\left(\frac{1}{1+z^n},z=e^{i\pi/n}\right)&=\lim_{z\to e^{i\pi/n}}\frac{(z-e^{i\pi/n})}{1+z^n}\\\\
&=\lim_{z\to e^{i\pi/n}}\frac{1}{nz^{n-1}}\\\\
&=\frac{1}{-ne^{-i\pi/n}}
\end{align}$$

Finally, putting it all together, we find that 
$$\int_0^{\infty}\frac{1}{1+x^n}dx=\frac{-2\pi i}{ne^{-i\pi/n}}\frac{1}{1-e^{i2\pi/n}}=\frac{\pi/n}{\sin(\pi/n)}$$
as expected!
