TITLE: Cauchy's Residue Theorem on a Singularity Outside a Contour
QUESTION [6 upvotes]: I recently ran into the following exercise:

Evaluate
  $$\oint_\Gamma\frac{\cos z}{(z-\pi)^2}dz,$$where $\Gamma$ is a complete circuit of the circle $|z|=1$.

Clearly, the singularity lies outside the contour:
                                    
However, recall Cauchy's Residue Theorem:

If $\Gamma$ is a simple closed positively oriented contour and $f$ is analytic inside and on $\Gamma$ except at the points $z_1$, $z_2$, ..., $z_n$, then
  $$\int_\Gamma f(z)dz=2\pi i\sum_{j=1}^{n}\text{Res}(z_j),$$
  where
  $$\text{Res}(f;z_0)=\lim_{z\to z_0}\frac{1}{(m-1)!}\frac{d^{m-1}}{dz^{m-1}}[(z-z_0)^mf(z)].$$

If I use this to evaluate the integral, I will have that
$$\text{Res}(f;\pi)=\lim_{z\to\pi}\frac{d}{dz}[\cos z]=0,$$and hence the value of the integral will evaluate to $0$, which is the correct answer.
Is this purely coincidental? Because, as I understand it, for Cauchy's theorem to hold, the singularities must lie within the contour (or perhaps not?). Thanks in advance!

REPLY [5 votes]: $$\oint_\Gamma\frac{\cos z}{(z-\pi)^2}dz=0$$
by Cauchy-Goursat Theorem because the function being integrated is holomorphic/analytic on $\Gamma$. 
That's it - no residues need to be computed!