For a complex function with an isolated singularity at a point z0, the residue at z0 is the a-1 coefficient of the function's Laurent series about z0:
       inf
       --                 n
f(z) = >   a_n  (z - z_0)
       --
     n=-inf


Res( f(z); z_0 ) = a_-1

Residues are used with the Residue theorem to calculate contour integrals of functions in the complex plane more easily. The value of an integral over a closed curve C is simply 2*pi*i times the sum of the residues of the singularities within it.

   /                   --
   |  f(z) dz = 2*pi*i >  Res( f(z); z_0 )
   /c                  --
                       z_0

Calculating residues at poles is easy. Suppose f(z) has an nth order pole at z0, i.e., it can be written in the form f(z) = phi(z)/(z-z0)n. Then

                     (n-1)
                   phi    (z_0)
Res( f(z); z_0 ) = ------------
                      (n-1)!

(Superscript here indicating the (n-1)st derivative at z_0).

Example: Find the residue of f(z) = (e^z)/z at z=0.

The Laurent series about the origin is

       1   /         z^2   z^3       \
f(z) = - * | 1 + z + --- + --- + ... |
       z   \          2     3!       /
 
       1       z
     = - + 1 + - + ...
       z       2
So by examination of the first term, the residue is just 1. Therefore any contour integral of f(z) around a closed curve containing the origin will be 2*pi*i.