Here is the interesting part. The way how they wrote it is because expand the denominator and then you will have
![](https://latex.codecogs.com/png.latex?\bg_white \frac{2x^{2}+1}{x^{2}+x-2})
.
Notice the
![](https://latex.codecogs.com/png.latex?\bg_white x^{2})
terms at all it is simply
![](https://latex.codecogs.com/png.latex?\bg_white \frac{2x^{2}}{x^{2}})
which will simplify to 2 and then knowing that
![](https://latex.codecogs.com/png.latex?\bg_white \frac{2x^{2}+1}{x^{2}+x-2}=2-\frac{2x-5}{x^{2}+x-2})
we will simplify
![](https://latex.codecogs.com/png.latex?\bg_white \frac{2x-5}{x^{2}+x-2})
. How did we get this you might be wondering
![](https://latex.codecogs.com/png.latex?\bg_white 2-\frac{2x-5}{x^{2}+x-2})
well the two comes from
![](https://latex.codecogs.com/png.latex?\bg_white 2x^{2}+2x-4)
you know multiplying the denominator by 2 because we are assuming that both the numerator and the denominator are
![](https://latex.codecogs.com/png.latex?\bg_white x^{2}+x-2)
so therefore how we got this part
![](https://latex.codecogs.com/png.latex?\bg_white -\frac{2x-5}{x^{2}+x-2})
is really just a balancing act to get the desired fraction on the LHS.
If you are finding anything confusing here feel free to reply to the message requesting a further explanation and someone will help you out.