The following is the residue theorem.
Theorem 16.7.1 Let Ω be an open set and let γ_{k} :

for all z
 (16.13) 
where here P denotes the set of poles of f in Ω. The sum on the right is a finite sum.
Proof: First note that there are at most finitely many singularities α which are not in the unbounded component of ℂ ∖∪_{k=1}^{m}γ_{k}^{∗}. Thus there exists a finite set,

and it is this last equation which is established. For z near α_{j},

where g_{j} is analytic at and near α_{j}. Now define

It follows that G

Now
The above is certainly a grand and glorious result but we typically have in mind something much more ordinary. As a review of the main ideas consider this.
You have a simple closed curve oriented such that the winding number is 1. Say γ is a parametrization for this curve. Then inside there are finitely many singularities

Letting γ_{k} ≡−

Now on the inside of γ_{k},
 (16.14) 
Thus ∫ _{γ1}f

Similarly, ∫ _{γk}f
Thus

In words, the contour integral is 2πi times the sum of the residues. This formulation is in a sense more general because it is only required that the function be continuous on γ^{∗} and analytic on the inside of γ^{∗} except for the exceptional points indicated.
So is there a way to find the residues? The answer is yes.
Procedure 16.7.2 Say you want to find res

This is the case where you have a pole of order M at a. You would multiply by

Then you would take M − 1 derivatives and then take the limit as z → a. This would give
You can see from the formula that this will work and so there is no question that the limit exists. Because of this, you could use L’Hospitals rule to formally find this limit. This rule pertains only to real functions of a real variable. However, since you know the limit exists in this case, you can pick a one dimensional direction and apply L’Hospital to the real and imaginary parts to identify the limit which is typically what needs to be done.