Suppose $f(z)$ is a rational function with poles at $z = z_n$ in the complex plane. Then consider the Laurent expansion of $f(z)$ around each pole (a Laurent expansion is the generalization of the Taylor expansion where you now include negative powers). Let $g_n(z)$ denote the sum of all the singular terms of the expansion of $f(z)$ around $z = z_n$. Then consider the function $h(z)$ defined as:
$$h(z) = f(z) - \sum_n g_n(z)$$
Clearly $h(z)$ is then also a rational function, but since we've subtracted all the singularities from f(z), the function $h(z)$ only has removable singularities, so, it is in fact a polynomial. If $f(z)$ has a numerator with a lower degree than its denominator, then we see that $h(z)$ tends t zero at infinity, which means that $h(z)$ is actually zero everywhere. In that case we thus have:
$$f(z) = \sum_n g_n(z)$$
If the degree of the numerator is not smaller than the degree of the denominator, then you can still use this formula if you interpret the point at infinity as a singularity. You then include the expansion around infinity where you regard singular terms as terms with positive powers of $z$.
In this particular case we may cut some corners and obtain the partial fraction expansion with hardly any computations. We have:
$$f(z) = \frac{1}{(2+z)^2 (4+z)}$$
Obviously, the coefficient of $\frac{1}{z+4}$ is $\lim_{z\to -4}(z+4)f(z) = \frac{1}{4}$. To find the part of the partial fraction expansion involving powers of $\frac{1}{z+2}$, observe that $f(z)$ for large $z$ tends to zero as $\frac{1}{z^3}$. This means that the $\frac{1}{z+2}$ term must have a coefficient of $-\frac{1}{4}$. And the coefficient of $\frac{1}{(z+2)^2}$ is obviously given by $\lim_{z\to -2}(z+2)^2f(z) = \frac{1}{2}$
So. without having had to do much work, we have obtained the result:
$$f(z) = \frac{1}{2} \frac{1}{(z+2)^2} - \frac{1}{4} \frac{1}{z+2} + \frac{1}{4}\frac{1}{z+4}$$