\(\dfrac{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+a^2\right)+\left(1+a+a^2\right)}{x^2\left(1-a+a^2\right)+\left(1-a+a^2\right)}\)
\(=\dfrac{\left(x^2+1\right)\left(1+a+a^2\right)}{\left(x^2+1\right)\left(1-a+a^2\right)}=\dfrac{a^2+a+1}{a^2-a+1}\)