I have to calculate the indefinite integral $$\int\frac{x^4-1}{x^2\sqrt{x^4+x^2+1}}$$
I tried a lot of unsuccessful substitutions and finally decided to try this Integral Calculator.
It did calculate the answer but I can't understand the steps it gave.
Particularly this step below is what I'm unable to get. I am familiar with partial fraction decomposition but I have no idea how to break the expression like this.
Can someone explain it to me or suggest some other way?

let $$I=\int \frac{x^4-1}{x^2\sqrt{x^4+x^2+1}}dx=\int \frac{x-x^{-3}}{\sqrt{x^2+x^{-2}+1}}dx=\frac{1}{2}\int \frac{dt}{\sqrt t}$$ $$=\sqrt{x^2+x^{-2}+1}+C$$ In the last one we use $x^2+x^{-2}+1=t.$