<s>[INST] Integrate $\int\frac{x^2-1}{(x^2+1)\sqrt{x^4+1}}dx$ I have tried parts which ended up into a more complex form, any suggestions?
$$\int\frac{x^2-1}{(x^2+1)\sqrt{x^4+1}}dx$$
 [/INST] Edit:  I decided that the previous solution admits a minor but nice generalization, so here goes.
Let $$t = \dfrac{x}{\sqrt{x^4+1}}, \quad dt = \frac{1-x^4}{(x^4+1)^{3/2}} \, dx.$$  Then $$\frac{1}{1 \pm 2t^2} = \frac{x^4+1}{x^4 + 1 \pm 2x^2} = \frac{x^4+1}{(1 \pm x^2)^2},$$ so that
$$ \begin{align*} \int \frac{x^2 \mp 1}{(x^2 \pm 1)\sqrt{x^4+1}} \, dx &= \int \frac{(x^2 \mp 1)(x^2 \pm 1)(x^4+1)}{(x^2 \pm 1)^2 (x^4+1)^{3/2}} \, dx \\ &= \int \frac{1}{1 \pm 2t^2 } \cdot \frac{x^4-1}{(x^4+1)^{3/2}} \, dx \\ &= - \int \frac{dt}{1 \pm 2t^2}.\end{align*}$$  In the positive case, we get $$- \frac{1}{\sqrt{2}} \tan^{-1} \sqrt{2}t + C = - \frac{1}{\sqrt{2}} \tan^{-1} \frac{x \sqrt{2}}{\sqrt{x^4+1}} + C.$$  In the negative case, we get $$\frac{1}{2\sqrt{2}} \log \left| \frac{1 - \sqrt{2}t}{1 + \sqrt{2}t} \right| + C = \frac{1}{2 \sqrt{2}} \log \left| \frac{\sqrt{x^4+1} - x \sqrt{2}}{\sqrt{x^4+1} + x \sqrt{2}} \right| + C.$$
</s>