Ive never seen integration where the singularities lie on the contour, is that even defined?
You need to define the contour with small semi-circles around the poles of radius some \delta and then take the limit as \delta tends to zero. In that way the function will be analytic in the domain that has avoided the singularities. When f is analytic inside a domain D the integral over D of f = 0. Check any book on complex analysis. You can find the details.