<s>[INST] 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 ?
 [/INST] As you wrote, $$\frac x {(x-1)(2x+1)(x+3)}=\frac {a_1}{x-1}+\frac {a_2}{2x+1}+\frac {a_3}{x+3}$$ As Peter commented, multiply everything by $(x-1)(2x+1)(x+3)$; this gives $$x=a_1(2x+1)(x+3)+a_2(x-1)(x+3)+a_3(x-1)(2x+1)$$ First make $x=1$ so $$1=a_1\times3\times 4=12a_1$$ Do the same with $x=-3$ and $x=-\frac 12$. You immediately get the value of each of the  $a_i$'s without needing to solve any equation.
Remember the trick : it is extremely useful.
</s>