<s>[INST] $\int (x^2+1)/(x^4+1)\ dx$ I have Divided the numerator and Denominator by $x^2$
to get $\dfrac{1+x^{-2}}{x^2+x^{-2}}$ then changed it into $(1+(x^{-2}))/[(x-x^{-1})^2 +2]$ then took $x-(1/x)$ as $u$ and Differentiated it with respect to $x$ to get $dx=du/(1+x^{-2})$  Finally I got this expression:
$$
\int\frac{x^2+1}{x^4+1} \, dx = \int (u^2+2)^{-1} \, du
$$
After this I need help!
 [/INST] Express MichaelRozenberg's denominator, $x^2 + \sqrt{2} x + 1$ in the form $u^2 + 1$ so you can use the $\tan^{-1}$ form.
Specifically:
$x^2 + \sqrt{2} x + 1$
Let $\sqrt{2}x + 1 = u$,
so
$u^2 = 2 x^2 + 2 \sqrt{2} x + 1$
so 
$u^2 + 1 = 2 x^2 + 2 \sqrt{2} x + 2$
or 
${1 \over u^2 + 1} = {1 \over x^2 + \sqrt{2} x + 1}$.
And likewise for the other term with the minus sign.
Now you have the arc tan integral formula, giving:
$$\frac{\tan ^{-1}\left(\sqrt{2} x+1\right)-\tan ^{-1}\left(1-\sqrt{2} x\right)}{\sqrt{2}}$$
</s>