Suppose $f=P/Q$ is a rational function and suppose $f$ has a simple pole at $a$. Then a formula for calculating the residue of $f$ at $a$ is \text{Res}(f(z),a)=\lim_{z\to a}(z-a)f(z)=\lim_{z\to a}\frac{P(z)}{\frac{Q(z)-Q(a)}{z-a}}=\frac{P(a)}{Q'(a)}.
In the second equality, how does the $Q(z)-Q(a)$ appear? I only see that it would equal $\lim_{z\to a}\frac{P(z)}{\frac{Q(z)}{z-a}}$.