There is a worked solution on Wikipedia using contour integration. I find it quite confusing.

Methods of contour integration - Wikipedia, the free encyclopedia

However, you don't have to resort to contour integration to solve the problem. There's a much easier (albeit longer) way.