Ok, what about the case of, say, $tan(z) = \frac{sin(z)}{cos(z)} at$latex z = \frac{\pi}{2}} \$? One way: note $lim_{z \rightarrow \frac{\pi}{2}} \frac{sin(z)(z-\frac{\pi}{2})}{cos(z)}$ can be evaluated by L’Hopital’s rule which leads to $lim_{z \rightarrow \frac{\pi}{2}}\frac{sin(z)+(z-\frac{\pi}{2})cos(z)}{-sin(z)} =-1$ and note how the product rule lead to the numerator being what it was. In general, if we are interested in $\frac{h(z)}{g(z)}$ where $h(z_0) \neq 0, g(z_0) = 0$ The residue will be given by $\frac{h(z_0)}{g'(z_0)}$ provided $g'(z_0) \neq 0$; that is, provided $g$ has a zero of order 1 at $z_0$
In general, if $f$ has a pole of order $m$ at $z=z_0$ then $f(z) = \frac{b_m}{(z-z_0)^m} + \frac{b_{m-1}}{(z-z_0)^{m-1}} + ...+\frac{b_1}{z-z_0} + ....$ so if we multiply both sides by $(z-z_)^m$ and then differentiate repeatedly and focus on the residue: $b_1(z-z_0)^{m-1}$ gets differentiated $m-1$ times to yield $(m-1)(m-2)....(2)(1) b_1$ so $b_1 = \frac{1}{(n-1)!}\frac{d^{m-1}}{dz^{m-1}}((z-z_0)^{m-1}f(z)$
Example: $\frac{1}{z^2 (z+1)}$ has a pole of order 2 at the origin. So the residue: $(\frac{z^2}{z^2(z+1)})' = -\frac{1}{(z+1)^2}$ which is $-1$ at $z = 0$. That is simpler than calculating the series.