How does this algebraic trick regarding partial fraction works? Suppose I have to evaluate the integral $$\int \frac{x}{(x-1)(2x+1)(x+3)} \, dx  $$
I write it as $$\frac{a_1}{x-1} +\frac{a_2}{2x+1} +\frac{a_3}{x+3}$$
where $a_1$, $a_2$, $a_3$ are constants. once I have foud relationaships between them I solve for the $a_{i}$ and subsequently substitute them into the integral.
It can be observed that for finding this constants we may use following trick.
Suppose we have to find $a_1$ then for time being remove the term beneath $a_1$ from the relation $$\frac{a_1}{x-1} +\frac{a_2}{2x+1} +\frac{a_3}{x+3}$$ now put the value of $x$ that would appear if the removed term is equated to $0$ in $\frac{x}{(x-1)(2x+1)(x+3)}$. This the value of constant $a_1$.
How does this works ?

Notice, the partial fractions $$\frac{x}{(x-1)(2x+1)(x+3)}=\frac{A}{x-1}+\frac{B}{2x+1}+\frac{C}{x+3}$$ On solving for $A, B, C$, we get $A=\frac{1}{12}$, $B=\frac{2}{15}$ & $C=-\frac{3}{20}$
$$=\frac{1}{12(x-1)}+\frac{2}{15(2x+1)}-\frac{3}{20(x+3)}$$
Hence, we have $$\int \frac{x}{(x-1)(2x+1)(x+3)}=\int\frac{1}{12(x-1)}+\frac{2}{15(2x+1)}-\frac{3}{20(x+3)}dx=$$ $$=\frac{1}{12}\ln(x-1)+\frac{1}{15}\ln(2x+1)-\frac{3}{20}\ln(x+3)+c$$
