I was doing Techniques of Integration. I had seen a weird rule. I am showing an example instead of rule. Cause, rule contains lots of weird constant.
$$\int \frac{3x \mathrm dx}{x^2-x-2}$$ $$=\int\frac{\frac{3}{2} (2x-1)+\frac{3}{2}}{x^2-x-2}\mathrm dx$$ $$=\frac{3}{2}\int \frac{2x-1}{x^2-x-2}\mathrm dx+\frac{3}{2}\int \frac{\mathrm dx}{(x-\frac{1}{2})^2-\frac{1}{4}-2}$$ $$=\frac{3}{2}\ln |x^2-x-2|+\frac{3}{2}\int\frac{\mathrm dx}{(x-\frac{1}{2})^2-\frac{9}{4}}$$
The problem arise in 4th line. I took the whole equation from book. They had integrated left one. But, I wonder where the numerator had gone? The rule also says the same thing. But, I can't understand where it had gone. Don't suggest to solve the problem any other way.
Note the if $g$ is differentiable and it has no zeros, and if $f(x)=\log\left(\bigl|g(x)\bigr|\right)$, then$$f'(x)=\frac{g'(x)}{g(x)}.$$In your case, take $g(x)=x^2-x-2$. Then $g'(x)=2x-1$. So, a primitive of $\frac{2x-1}{x^2-x-2}$ is $\log\bigl|x^2-x-2\bigr|$.