There is a nice method for rational functions that only have one repeated factor at the denominator: let the fraction be $f(x)=\frac{N(x)}{D(x)}$ where $D(x)=d(x)^k$.
The general form of the partial fraction decomposition is
$$\displaystyle f(x)=\frac{a_1(x)}{d(x)}+\frac{a_2(x)}{d(x)^2}+\dots+\frac{a_k(x)}{d(x)^k}$$
Then, if you perform the division of $N(x)$ by $d(x)$, you can write $f(x)$ as
$$\displaystyle f(x)=q(x)d(x)+r_1(x)$$
where $\deg(r_1)<\deg(d)$. We then got
$$\displaystyle f(x)=\frac{q(x)d(x)+r_1(x)}{d(x)}=\frac{r_1(x)}{d(x)}+\frac{q(x)}{d(x)^{k-1}}$$
so $r_1$ is actually $a_1$. By repeating the process with $q$, we can get all the other functions $a_2$,...,$a_k$.
Example with $\frac{2x}{(x+2)^2}=\frac{A}{x+2}+\frac{B}{(x+2)^2}$: $2x=2(x+2)-4$, so $A=-4$ and $q(x)=2$. As $q(x)=0(x+2)+2$, we obviously have $B=2$. We obtain
$$f(x)=\frac{2(x+2)-4}{(x+2)^2}=\frac{2}{(x+2)}+\frac{-4}{(x+2)^2}$$
When $d(x)$ has degree $1$, we can use Synthetic Division to perform the division, so it is very fast.