<s>[INST] 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.
 [/INST] 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}}
$$
</s>