Let $A$ and $B$ be real numbers such that $\frac{A}{x-5}+B(x+1)=\frac{-3x^2+12x+22}{x-5}$. What is $A+B$?
By long division, (-3x^2 + 12x + 22)/(x - 5) = -4x -4 + 9/(x - 5) = 9/(x - 5) + (-4)(x + 1), so A + B = 9 + (-4) = 5.