TITLE: Decomposition into partial fractions to compute an integral
QUESTION [5 upvotes]: I'm having problems with: 
$$\int_{-\infty}^{\infty}\frac{x^4+1}{x^6+1}dx$$
I was thinking: $\frac{x^4+1}{x^6+1}$ is an even function and the interval $(-\infty,\infty)$ is symmetric about 0, we could write the integral like:
$$2\int_{0}^{\infty}\frac{(x^4+1)}{x^6+1}dx$$
And for $\frac{x^4+1}{x^6+1}$, I will use the partial fractions. I will write $x^6+1$ like a sum of cubes $x^6+1=(x^2)^3+1^3$ and use the formula $a^3+b^3=(a+b)(a^2-ab+b^2)$ and in the end we will have 
$$x^6+1=(x^2+1)(x^4-x^2+1)$$ But now I'm stuck and do not know how to decompose $x^4-x^2+1$. I was thinking about $(x^2-1)x^2+1$ or $(x^2-\frac{1}{2})^2+\frac{3}{4}$ but I need a form for that like $-(-1+\sqrt3 x-x^2) (1+\sqrt3 x+x^2)$...
A little help here?

REPLY [2 votes]: $$\begin{eqnarray*}\int_{\mathbb{R}}\frac{x^4+1}{x^6+1}\,dx&=&2\int_{\mathbb{R}^+}\frac{x^4+1}{x^6+1}\,dx=2\int_{0}^{1}\frac{x^4+1}{x^6+1}\,dx+2\int_{1}^{+\infty}\frac{x^4+1}{x^6+1}\,dx\\&=&4\int_{0}^{1}\frac{x^4+1}{x^6+1}\,dx=4\int_{0}^{1}\sum_{k\geq 0}(-1)^k\left(x^{6k}+x^{6k+4}\right)\,dx\\&=&4\sum_{k\geq 0}(-1)^k\left(\frac{1}{6k+1}+\frac{1}{6k+5}\right)=4\sum_{k\geq 0}\frac{\chi(k)}{k}\end{eqnarray*}$$
where $\chi(k)$ is a Dirichlet character $\!\!\pmod{12}$, that equals one if $k\in\{1,5\}\pmod{12}$, minus one if $k\in\{7,11\}\pmod{12}$ and zero otherwise. We know in advance that:
$$ \sum_{k\geq 0}\frac{(-1)^k}{2k+1}=\arctan 1=\frac{\pi}{4},$$
$$ \sum_{k\geq 0}\frac{(-1)^k}{6k+3}=\frac{1}{3}\,\arctan 1=\frac{\pi}{12},$$
hence by summing these series we get $\sum_{k\geq 0}(-1)^k\left(\frac{1}{6k+1}+\frac{1}{6k+5}\right)=\frac{\pi}{3}$, so:

$$ \int_{\mathbb{R}}\frac{x^4+1}{x^6+1}\,dx = \color{red}{\frac{4\pi}{3}}.$$