NOTE: bad example, but the question at the end still holds $\to$ solution: don't forget about the semi-circular paths!
Let's consider the following integral:
$$ \int_{-\infty}^\infty \mathrm dx \frac{1}{x-\mathrm i} $$
This integrand has a pole at $x=\mathrm i$. When I close the contour in the upper complex plane, I pick up the residue 1, which leads to the result
$$ \int_{-\infty}^\infty \mathrm dx \frac{1}{x-\mathrm i} = 2\pi \mathrm i \sum \text{contour orientation}\times\text{residues} = 2\mathrm i\pi $$
But when I close the contour in the lower plane, there is no residue, so the result is zero. How do I make sense of these two seemingly different results?
Because of the chosen tags I would assume that you are interested in the principal value of this integral since otherwise it cannot be evaluated in view of its divergence. The residue theorem is the correct tool for computing the Cauchy principal value.
The reason for your seemingly different results for the upper and lower half-plane contours is the false assumption that the value of the integral along the semicircular path is $0$. However it is simple to show using the path along arc of the circle centered at $z=i $ that the integral value is equal (in the limit $R\to\infty $) to $\pi i $ and $-\pi i $ for the upper and lower half-plane, respectively.
Subtracting the value from the residue of the poles surrounded by the respective contour one obtains the principal value $\pi i $ for the integral in question in both cases. No contradiction arises.