Here is how partial fraction decomposition works. First, take a fraction like $\frac{1}{n(n+1)}$. You can express this fraction as the sum $\frac{A}n + \frac{B}{n+1}$ for some constants $A$ and $B$. Thus, you have the equation $\frac{1}{n(n+1)} = \frac{A}n + \frac{B}{n+1}$. Now, multiply both sides by $n(n+1)$ to get $1=A(n+1)+B(n)$. However, note that the expression $\frac{x}{x} = 1$ ONLY when $x \ne 0$ because division by $0$ is forbidden. Thus, $1=A(n+1)+B(n)$ only if $n \ne 0,-1$ because these are the values that cause division by $0$. However, many people plug in $n=0,-1$ to solve for $A,B$ even though that is an illegal move, and it works.
Plugging in $n=0$, we get $1=A$. Plugging in $n=-1$, we get $1 =-B$, thus $B=-1$. So, we have $\frac{1}{n(n+1)} = \frac{A}n + \frac{B}{n+1} = \frac{1}n - \frac{1}{n+1}$. This is true.
However, I don't understand why it works, even though you used an illegal move?