To go from left to right, first assume
$$\frac{x^2}{(x^2-1)(x^2+1)}=\frac{A}{x^2-1}+\frac{B}{x^2+1}$$
A practical trick to get A is multiplying everything by $(x^2-1)$ and make it zero, so one gets
$$\frac{x^2}{(x^2-1)(x^2+1)}(x^2-1)=\frac{A}{x^2-1}(x^2-1)+\frac{B}{x^2+1}(x^2-1)$$
Now cancel those zeros in the numerator and denominator in the lhs and the first fraction of the rhs and make the second fraction of the rhs zero:
$$\frac{x^2}{(x^2+1)}=A$$
This happens at $(x^2-1)=0$, equivalently $x^2=1$; substitute in the lhs and you are done with A.
$$\frac{1}{1+1}=A$$
The same procedure multiplying everything by $(x^2+1)$ and then using $x^2=-1$ yields B.
(Edit after the comment)
Multiply everything by $(x^2+1)$
$$\frac{x^2}{(x^2-1)(x^2+1)}(x^2+1)=\frac{A}{x^2-1}(x^2+1)+\frac{B}{x^2+1}(x^2+1)$$
The remaining fractions after cancelling are
$$\frac{x^2}{(x^2-1)}=B$$
The condition is $x^2=-1$ and substituting in the lhs gives
$$\frac{-1}{-1-1}=\frac{1}{2}=B$$
This is the right real value for B although $x^2=-1$ corresponds to an imaginary $x$.