Notice that x2 + x - 2 = (x+2)(x-1). So, dividing by x2 + x - 2 is the same as dividing by (x-1) and then (x-2). This is just like noticing that 30/10 = 3 is the same as 30/(5×2) = (30/5)/2 = 6/2 = 3.
Let's work through a similar problem with actual numbers first just so you get an idea of the process:
What is the remainder of 37 divided by (3×5)?
You know the answer is 7, since 37/(3×5) = 37/15 = 2 R7. But let's say we wanted to divide by 3 and then 5. How can we get that remainder of 7, using only the fact that 37/3 has a remainder of 1 and 37/5 has a remainder of 2?
Start by dividing by 3, which results in some number plus the remainder of 1 over 3:
37/3 = 12 + 1/3
Now, divide that by 5:
(12 + 1/3)/5 = 12/5 + 1/15
Since 3 and 5 have no factors in common, 12/5 has the same remainder as 37/5. So, replace 12/5 with some number plus the remainder of 2 over 5:
12/5 + 1/15 = 2 + 2/5 + 1/15
We don't care about that first 2. We just care about those two fractions. Let's use the common denominator of 15 to combine them:
2/5 + 1/15 = 6/15 + 1/15 = 7/15
So, the remainder when dividing by 15 is 7, just like we wanted. We'll use this same process to solve your problem.
Divide f(x) by (x-1) and you'll get some polynomial p(x) plus the remainder of 4 over (x-1):
f(x)/(x-1) = p(x) + 4/(x-1)
Now, divide that by (x+2):
f(x)/((x-1)(x+2)) = (p(x) + 4/(x-1))/(x+2)
f(x)/(x2 + x - 2) = p(x)/(x+2) + 4/((x-1)(x+2))
Like in our example, p(x)/(x+2) has the same remainder as f(x)/(x+2). So, replace that with some other polynomial q(x) plus the remainder of -2 over (x+2):
f(x)/(x2 + x - 2) = q(x) + -2/(x+2) + 4/((x-1)(x+2))
We don't care about q(x), we just care about the fractions. So, let's give them a common denominator of (x-1)(x+2):
(-2(x-1)) / ((x-1)(x+2)) + 4 / ((x-1)(x+2)) = (-2(x-1) + 4) / ((x-1)(x+2)) = (-2x + 2 + 4) / ((x-1)(x+2))
That's (-2x + 6) / (x2 + x - 2), which means you have a remainder of -2x + 6 when dividing f(x) by x2 + x - 2.