Calculation of an integral via residue. $$\int_{-\infty}^{\infty}{{\rm d}x \over 1 + x^{2n}}$$
How to calculate this integral? I guess I need to use residue. But I looked at its solution. But it seems too complicated to me. Thus, I asked here. Thank you for help. 
 A: I'm pretty sure this has been done on this site, but because I cannot locate it, I will quickly work it out.
Because the integrand is even, you can write the integral as
$$2 \int_0^{\infty} \frac{dx}{1+x^{2 n}}$$
Now consider the contour integral
$$\oint_C \frac{dz}{1+z^{2 n}}$$
where $C$ is a wedge contour that goes from $[0,R]$ on the real axis, then along the arc $z=R e^{i \phi}$, where $\phi \in [0,\pi/n]$, and then along the line $z=e^{i \pi/n}t$, where $t \in [R,0]$.  The contour integral is then equal to
$$\int_0^R \frac{dx}{1+x^{2 n}} + i R \int_0^{\pi/n} d\phi \, \frac{e^{i \phi}}{1+R^{2 n} e^{i 2 n \phi}} + e^{i \pi/n} \int_R^0 \frac{dt}{1+t^{2 n} e^{i 2 \pi n/n}}$$
The second integral vanishes as $1/R^{2 n-1}$the limit as $R \to \infty$.  The contour integral is then equal to, in this limit:
$$\left (1-e^{i \pi/n} \right ) \int_0^{\infty} \frac{dx}{1+x^{2 n}} $$
By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the residue at the only pole of the integrand interior to $C$, which is at $z=e^{i \pi/(2 n)}$.  The residue there is equal to
$$\frac{1}{2 n e^{i (2 n-1) \pi/(2 n)}} = -\frac{1}{2 n} e^{i \pi/(2 n)} $$
Therefore the integral is given by
$$\left (1-e^{i \pi/n} \right ) \int_0^{\infty} \frac{dx}{1+x^{2 n}}  = -i 2 \pi \frac{1}{2 n} e^{i \pi/(2 n)}$$
and thus
$$\int_{-\infty}^{\infty} \frac{dx}{1+x^{2 n}} = \frac{\pi/n}{\sin{[\pi/(2 n)]}}$$
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

An alternative:

\begin{align}
\int_{-\infty}^{\infty}{\dd x \over x^{2n} + 1} & =
2\int_{0}^{\infty}{\dd x \over x^{2n} + 1}
\,\,\,\stackrel{t\ =\ 1/\pars{x^{2n} + 1}}{=}\,\,\,
2\int_{1}^{0}t\bracks{\partiald{}{t}\pars{{1 \over t} - 1}^{1/\pars{2n}}}\,\dd t \\[5mm] &=
-2\int_{0}^{1}t\bracks{{1 \over 2n}\pars{{1 \over t} - 1}^{1/\pars{2n} - 1}
\pars{-\,{1 \over t^{2}}}}\,\dd t
\\[5mm] & =
{1 \over n}\int_{0}^{1}t^{-1/\pars{2n}}\pars{1 - t}^{1/\pars{2n} - 1}\,\dd t =
{1 \over n}\,{\Gamma\pars{-1/\bracks{2n} + 1}\Gamma\pars{1/\bracks{2n}} \over \Gamma\pars{1}}
\\[5mm] & =
\bbx{\ds{{1 \over n}\,{\pi \over \sin\pars{\pi/\bracks{2n}}}}}\,,\qquad
\Re\pars{n} > {1 \over 2}
\end{align}
