If a parameter-dependent contour integral has a moving pole, deforming the integration contour continuously so that the pole never crosses it preserves a holomorphic branch. Returning the contour to its original path after crossing a pole adds or subtracts the corresponding residue contribution.
Codex Wiki