In the second picture, $\displaystyle (x^2-1)$ has been taken a common factor in the numerator.
Example:
$\displaystyle ab^2-cb^2=b^2(a-c)$.. this term has $\displaystyle b^2$ as its common factor..
$\displaystyle -abc+a^2b^2c^2 = -abc(1-abc)$.. here you are taking -abc as a common factor.
similarly, $\displaystyle -2x(x^2-1)$ is a common factor in picture 1...