=(x^2+x^2a+a+a^2+a^2x^2+1)/(x^2-x^2a-a+a^2+a^2x^2+1)
=\(\dfrac{x^2\left(1+a^2\right)+a^2+1+x^2a+a}{x^2+a^2x^2+a^2+1-x^2a-a}\)
\(=\dfrac{\left(1+a^2\right)\left(x^2+1\right)+a\left(x^2+1\right)}{x^2\left(1+a^2\right)+\left(a^2+1\right)-a\left(x^2+1\right)}\)
\(=\dfrac{\left(x^2+1\right)\left(a^2+a+1\right)}{\left(a^2+1\right)\left(x^2+1\right)-a\left(x^2+1\right)}=\dfrac{a^2+a+1}{a^2-a+1}\)