The techniques shown above fail if a pole occurs on the real axis, since we don’t know what side of the contour it lies! The technique to deal with that is usually based on physics: Determine whether there are physical conditions that must be satisfied on the quantity you wish to evaluate. Decide whether these imply that a pole should contribute (which means we need to move the pole just inside the contour) or whether it should not contribute (move pole just outside the contour). There are even cases where the logical choice is to asign half on the inside and half on the outside. Clearly, the physical background decides which choice to make.