Formula for calculating residue at a simple pole. 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}}$.

Because $a$ is a zero of $Q(z)$; i.e., $$Q(a) = 0.$$
So, $$Res_{a}f(z)=\lim_{z→a}(z−a)f(z)  =\lim_{z→a}\frac{P(z)}{\frac{Q(z)}{z−a}} =\lim_{z→a}\frac{P(z)}{\frac{Q(z) - 0}{z−a}} = \lim_{z→a}\frac{P(z)}{\frac{Q(z)−Q(a)}{z−a}}= \frac{P(a)}{Q′(a).}$$
Then this is a "trick" to compute residue for a simple pole.
