At a simple pole, multiplying by $z - a$ exposes the residue. At a pole of order $m$, multiply by $(z - a)^m$ instead: the residue is then hidden one step deeper, as a Taylor coefficient that a few derivatives can reach.
🔑 Key idea
If $f$ has a pole of order $m$ at $a$, then
$$\operatorname{Res}(f, a) = \frac{1}{(m - 1)!}\lim_{z \to a}\frac{d^{m - 1}}{dz^{m - 1}}\Big[(z - a)^mf(z)\Big].$$
Often a series expansion is faster: the residue is the coefficient of $(z - a)^{m - 1}$ in the Taylor series of $(z - a)^mf(z)$.
💡 Why it works
With $f = \frac{c_{-m}}{(z - a)^m} + \cdots + \frac{c_{-1}}{z - a} + c_0 + \cdots$, the function $g(z) = (z - a)^mf(z) = c_{-m} + \cdots + c_{-1}(z - a)^{m - 1} + c_0(z - a)^m + \cdots$ is analytic at $a$. Its Taylor coefficient of $(z - a)^{m - 1}$ is $c_{-1}$, and Taylor's formula says that coefficient equals $\frac{g^{(m - 1)}(a)}{(m - 1)!}$.
$\frac{e^z}{z^3}$ has a pole of order 3 at $0$; its residue is $\frac{1}{2!}(e^z)''\big|_{0} = \frac{1}{2}$, so the integral is $\pi i$.
The residue is $-\frac{1}{6}$. (The pole has order 3, not 4, because $\sin z$ vanishes at $0$.)
Answer: $-\frac{1}{6}$
Which method to use? For a pole of order 2 the derivative formula is usually quickest: one derivative of $(z - a)^2f(z)$. For order 3 or more, or when the top is $\sin$, $\cos$ or $e^z$, expanding in a series and reading off one coefficient is often faster and less error-prone than taking several derivatives of a quotient.
✏️ Worked example: A pole of order 2 at a complex point
A useful special case: if $f = \frac{g(z)}{(z - a)^m}$ with $g$ analytic at $a$, the residue is $\frac{g^{(m - 1)}(a)}{(m - 1)!}$, the coefficient of $(z - a)^{m - 1}$ in the Taylor series of $g$.
⚠️ Common mistake
Forgetting $\frac{1}{(m - 1)!}$, or using the wrong order $m$. For $\frac{e^z}{z^4}$, $m = 4$ and the residue is $\frac{1}{3!}(e^z)'''(0) = \frac{1}{6}$, not $1$. And for $\frac{\sin z}{z^4}$ the order is $3$, since the top vanishes at $0$; using $m = 4$ still works (an overestimate of $m$ is harmless if you differentiate correctly), but using too small an $m$ gives nonsense. Check against the Laurent series when in doubt.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.