We have,#x^2-3x-4=x^2-4x+x-4=x(x-4)+1(x-4)=(x+1)(x-4)#
So, #3/(x+1)+(2x-5)/(x^2-3x-4)=3/(x+1)+(2x-5)/((x+1)(x-4))# #=(3(x-4))/((x+1)(x-4))+(2x-5)/((x+1)(x-4))# #=(3(x-4)+2x-5)/((x+1)(x-4))=(3x-12+2x-5)/((x+1)(x-4))=(5x-17)/((x+1)(x-4))=(5x-17)/(x^2-3x-4)#