Say you want to evaluate an integral over some domain, so one option is to write the integral as a contour integral in the complex plane. However, there can sometimes be several different contours that all cover the same domain, but may lead to different values in the event of singularities right? It seems that depending on the location of the singularities you could avoid them by a suitable contour or wrap your contour around them so as to use the residue theorem. I don't understand how the contour is to be chosen then if different routes may lead to different values, could someone please explain this to me? What conditions must the contour you choose satisfy?