While I personally never have seen a problem like this, I would solve it as follows.
Find two numbers, that when added give the "b". (-6,+1), but (-3, -2) also works here.
Then use long division with your functions to calculate the remainder of n^2-5n+1/((n-6)(n+1))
Does this answer your question?