How to evaluate $\int_{-\infty}^{\infty} \frac{1}{x^6+1}\,dx$? I am trying to understand how to evaluate the following integral.
$$\int_{-\infty}^{\infty} \dfrac{1}{x^6+1}dx$$
We start by considering $f(z) = \dfrac{1}{z^6+1}dz.$ Then we find that $z_k = \exp \left (i \left (\frac{\pi}{6}+\frac{\pi k}{3}\right)\right )$, and simple poles occur when $k=0,1,2,3,4,5$.
Then
$$\text{Res}(f,z_k)= \dots =\dfrac{1}{6}\lim_{z \to z_k} z^{-5}= \dfrac{1}{6} \exp \left( -\frac{5 \pi i}{6} (1 +2k) \right)$$
I think that in the missing part, the following formula is used, 
$$\text{Res}(f,c)=\frac{1}{(n-1)!}\lim_{z \to c} \frac{d^{n-1}}{dz^{n-1}} ((z-c)^n f(z)) $$
that $n=4$ and that a cancellation occurs (otherwise it would be really messy), but I'm not sure how to do it. How do I proceed?
Thanks for your help.
 A: This is rather peculiar: the denominator factors to
$$ \prod_{k=0}^5 (z-z_k), $$
and the function has no real roots, so you take the three in the upper half-plane and find the residues at their poles. The three roots are simple, so the residue formula in its most basic form should be used, and you find something like
$$ 2\pi i \left( \prod_{k=1}^5 \frac{1}{z_0-z_k} + \prod_{\substack{k=0 \\ k \neq 1}}^5 \frac{1}{z_1-z_k} + \prod_{\substack{k=0 \\ k \neq 2}}^5 \frac{1}{z_2-z_k} \right). $$
But as far as I know, there is no simpler way of doing this: you can make various simplifications, but you still end up having to push quite a lot of algebra through.

However, you don't need to do it that way: first, the integrand is symmetric, so the integral is twice the integral over $[0,\infty)$. Now substitute $x=y^{1/6}$, so
$$ I = 2 \int_0^{\infty} \frac{1}{6} \frac{y^{-5/6}}{1+y} \, dy $$
There are a variety of ways of doing this integral, probably the easiest being to substitute $u=y/(1+y)$. Then $y= u/(1-u)= 1+\frac{1}{u-1}$, $dy = \frac{1}{(1-u)^2} \, du $, so
$$ I = \frac{1}{3} \int_0^1 \left( \frac{u}{1-u} \right)^{-5/6} \frac{1-u}{1-u+u} \frac{1}{(1-u)^2} \, du = \frac{1}{3} \int_0^1 u^{-5/6} (1-u)^{-1/6} \, du = \frac{1}{3}\frac{\Gamma(1/6)\Gamma(5/6)}{\Gamma(1)} = \tfrac{1}{3}\pi\csc{\tfrac{1}{6}\pi}, $$
using the Beta function.
A: I'll try to generalize
Chappers's nice result
and see if I get anywhere.
Let
$J_n
=\int_{0}^{\infty} \dfrac{1}{x^n+1}dx
$,
where
$n > 1$.
Note that this is
half of the integral from
$-\infty$ for even $n$,
but is nicer to work with.
Let $x = y^{1/n}$,
so
$dx = \frac1{n}y^{1/n-1}dy$.
Then
$J_n
=\int_{0}^{\infty}\frac1{n} \dfrac{y^{1/n-1}dy}{y+1}
$.
As was done,
let
$u=\frac{y}{1+y}$
so
$y = \frac{u}{1-u}$.
Then
$dy = \frac{1}{(1-u)^2} \, du$
so
$\begin{array}\\
J_n
&=\frac1{n}\int_{0}^{1} \dfrac{\left(\frac{u}{1-u}\right)^{1/n-1}du}{(1-u)^2(1+u/(1-u))}\\
&=\frac1{n}\int_{0}^{1} \dfrac{u^{1/n-1}(1-u)^{1-1/n}du}{(1-u)(1-u+u)}\\
&=\frac1{n}\int_{0}^{1} u^{1/n-1}(1-u)^{-1/n}du\\
&=\frac1{n}B(1/n, -1/n+1) \quad\text{(the Beta function)}\\
&=\dfrac{\Gamma(1/n)\Gamma(-1/n+1)}{n\Gamma(1)}\\
&=\dfrac1{n}\Gamma(1/n)\Gamma(-1/n+1)\\
&=\dfrac1{n}\dfrac{\pi}{\sin(\pi/n)}\quad\text{(reflection formula)}\\
&=\dfrac{\pi\csc(\pi/n)}{n}\\
\end{array}
$
and it works out fine.
Note that I did almost nothing
original here -
I replaced $6$ with $n$
and followed
Chappers's script.
A: I would like to help with the algebra which needn't be difficult. 
Suppose we seek to evaluate
$$\int_{-\infty}^{+\infty} \frac{1}{1+x^{2m}} dx$$
which does not have a pole on the real axis at $x=-1.$

I think the  approach of using the residues of the  poles in the upper
half  plane is  not  necessarily  the best  here,  for an  alternative
consult                 e.g.                 this                 MSE
link.

Note that the poles at 
$\rho_k = \exp(\frac{\pi i}{2m} + \frac{\pi i k}{m})$
are simple and hence the residues are given by
$$\left.\frac{1}{(x^{2m}+1)'}\right|_{x=\rho_k}
= \left.\frac{1}{2mx^{2m-1}}\right|_{x=\rho_k}
= \left.\frac{x}{2mx^{2m}}\right|_{x=\rho_k}
= -\frac{1}{2m}\rho_k.$$
Therefore we get for the sum of the residues
$$-\frac{1}{2m} \exp\left(\frac{\pi i}{2m}\right)
\sum_{k=0}^{m-1} \exp\left(\frac{\pi i k}{m}\right)
= -\frac{1}{2m} \exp\left(\frac{\pi i}{2m}\right)
\frac{\exp(\pi i m/m)-1}{\exp(\pi i/m)-1}
\\ = \frac{1}{m} \exp\left(\frac{\pi i}{2m}\right)
\frac{1}{\exp(\pi i/m)-1}
\\ = \frac{1}{m} 
\frac{1}{\exp(\pi i/2/m)-\exp(-\pi i/2/m)}
\\ = \frac{1}{m\times 2i} \frac{1}{\sin(\pi/2/m)}.$$
This yields for the integral
$$2\pi i \times 
\frac{1}{m\times 2i} \frac{1}{\sin(\pi/2/m)}
= \frac{1}{m} \frac{\pi}{\sin(\pi/2/m)}.$$
A: You only need to consider the pole at $\exp(i\pi/6)$, because you can consider the contour from $0$ to $R$, from $R$ to $R\exp(i \pi/3)$ and then back to $0$ along the line $z = r\exp(i \pi/3)$ where $r$ goes from $R$ to $0$. In the limit of $R$ to infinity, the contour integral becomes:
$$I_c = \left[1-\exp\left(\frac{i\pi}{3}\right)\right] \int_0^{\infty}\frac{dx}{x^6+1} $$
The residue theorem yields:
$$I_c = 2\pi i\lim_{z\to\exp\left(i\pi/6\right)}\frac{z-\exp\left(\frac{i \pi}{6}\right)}{z^6+1} = \frac{i\pi}{3}\exp\left(-\frac{5i \pi}{6}\right)$$
Therefore
$$\int_{-\infty}^{\infty}\frac{dx}{x^6+1} =\frac{\pi}{3\sin\left(\frac{\pi}{6}\right)}=\frac{2\pi}{3} $$
A: We first resolve the integrand into partial fractions.
$$
\frac{1}{x^{6}+1}=\frac{1}{3\left(x^{2}+1\right)}-\frac{x^{2}-2}{3\left(x^{4}-x^{2}+1\right)}
$$
Integrating both sides yields
$$
3 \int_{0}^{\infty} \frac{d x}{x^{6}+1}=\int_{0}^{\infty} \frac{d x}{x^{2}+1}-\int_{0}^{\infty} \frac{x^{2}-2}{x^{4}-x^{2}+1} d x
$$
Obviously,
$$
\int_{0}^{\infty} \frac{d x}{x^{2}+1}=\left[\tan ^{-1} x\right]_{0}^{\infty}=\frac{\pi}{2} 
$$
Now let’s deal with the latter one.
$$
\begin{aligned}
\int_{0}^{\infty} \frac{x^{2}-2}{x^{4}-x^{2}+1} d x = &\int_{0}^{\infty} \frac{1-\frac{2}{x^{2}}}{x^{2}+\frac{1}{x^{2}}-1} d x
\\=& \frac{3}{2} \int_{0}^{\infty} \frac{\left(1-\frac{1}{x^{2}}\right) d x}{x^{2}+\frac{1}{x^{2}}-1}-\frac{1}{2} \int_{0}^{\infty} \frac{\left(1+\frac{1}{x^{2}}\right) d x}{x^{2}+\frac{1}{x^{2}}-1} \\
=& \frac{3}{2} \int_{0}^{\infty} \frac{d\left(x+\frac{1}{x}\right)}{\left(x+\frac{1}{x}\right)^{2}-3}-\frac{1}{2} \int_{0}^{\infty} \frac{d\left(x-\frac{1}{x}\right)}{\left(x-\frac{1}{x}\right)^{2}+1} \\
=& \frac{\sqrt3}{4}\left[\ln \left|\frac{x+\frac{1}{x}-\sqrt3}{x+\frac{1}{x}+\sqrt3}\right|\right]_{0}^{\infty}-\frac{1}{2}\left[\tan ^{-1}\left(x-\frac{1}{x}\right)\right]_{0}^{\infty} \\
=&-\frac{\pi}{2}
\end{aligned}
$$
Hence
$$
3 \int_{0}^{\infty} \frac{d x}{x^{6}+1}=\frac{\pi}{2}+\frac{\pi}{2}=\pi
$$
Now we can conclude that
$$
\boxed{\int_{-\infty}^{\infty} \frac{d x}{x^{6}+1}=\frac{2 \pi}{3}}
$$
