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 ?

We have $$\frac{x}{(x-1)(2x+1)(x+3)}=\frac{a_1}{x-1}+\frac{a_2}{2x+1}+\frac{a_3}{x+3}.$$
Then, we get $$(x-1) \times \frac{x}{(x-1)(2x+1)(x+3)}=\frac{x}{(2x+1)(x+3)}=a_1+\frac{a_2(x-1)}{2x+1}+\frac{a_3(x-1)}{x+3}. $$ If we take $x=1,$ then we find 
$$\frac{1}{3 \times 4}=\frac{1}{12}=a_1.$$ We proceed similarly, we get $$(2x+1) \times \frac{x}{(x-1)(2x+1)(x+3)}=\frac{x}{(x-1)(x+3)}=\frac{a_1(2x+1)}{x-1}+a_2+\frac{a_3(2x+1)}{x+3}.$$ If $x=-1/2$ then, $a_2=2/15.$ Finally,
$a_3=3/20.$ So, $$\frac{x}{(x-1)(2x+1)(x+3)}=\frac{1}{12(x-1)}+\frac{2}{15(2x+1)}+\frac{3}{20(x+3)}.$$ 
