<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] Since $x^4+1=x^4+2x^2+1-2x^2=(x^2+\sqrt2x+1)(x^2-\sqrt2x+1)$, we obtain
$$\frac{x^2+1}{x^4+1}=\frac{1}{2}\left(\frac{1}{x^2+\sqrt2x+1}+\frac{1}{x^2-\sqrt2x+1}\right).$$
Now, use $\int\frac{1}{1+x^2}dx=\arctan{x}+C$.
</s>