When Cauchy integral and when Cauchy residue..? $\int_C\tan(z)dz$ where $C$ is the circle $\vert z\vert=2$
What should be applied to evaluate the following solution?
Is it Cauchy integral or residue?
 A: Typically, the residue theorem is used for evaluating a contour integral, while Cauchy's integral formula is used for evaluating a function.  Notice the difference between Cauchy's formula:
$$
f(z_0)=\frac{1}{2\pi i}\oint_C \frac{f(z)}{z-z_0}dz
$$  which holds for functions which are holomorphic throughout a region which contains the circle $C$, and the residue theorem:
$$
\oint_C f(z)dz=2\pi i\sum\text{Res}[f,z_j],
$$ which holds for functions which are holomorphic inside a region containing $C$ except possibly at the points $z_j$.
The connection is, of course, that if $f(z)$ has a simple pole at $z=z_0$, then $g(z)=(z-z_0)f(z)$ is holomorphic, and the residue is $g(z_0)$.  Then the residue theorem is exactly Cauchy's integral formula, after dividing over the $2\pi i$.  If the pole is of higher-order, then the "generalized Cauchy integral formula" is the same as the residue theorem, but the residues are calculated using the general residue formula.
A: The question you should ask yourself is, Are there poles of $\tan{z}$ inside $C$, i.e., $|z|=2$?
Note than $\tan{z}$ goes to infinity when $z=\pm \pi/2$.  Are there others?
In this case, you use the residue theorem and compute the residues at each of the poles inside $C$.
You can show that, when the integrand of an integral takes the form $p(z)/q(z)$, the residue at a zero $z_0$ of $q$ is $p(z_0)/q'(z_0)$.  Can you express $\tan(z)$ in this form?
