Let's simplify the problem first by integrating from $-1$ to $1$. There is a discontinuity at $0$, so you write the integral as
$$\int_{-1}^{1}\frac{1}{x}dx=\lim_{\epsilon\to0+}\left(\int_{-1}^{-\epsilon}\frac{1}{x}dx+\int_{\epsilon}^1\frac{1}{x}dx\right)$$
If you perform this calculation, you obtain zero. But that is not the only possible way to write the integral. You can equally well write it as
$$\int_{-1}^{1}\frac{1}{x}dx=\lim_{\epsilon\to0+}\left(\int_{-1}^{-\epsilon}\frac{1}{x}dx+\int_{2\epsilon}^1\frac{1}{x}dx\right)$$
Note that I've change the lower limit of the second integral. Now obviously you will get a nonzero answer. Or I can change the upper limit of the first integral to be $-5\epsilon$.
In addition, you get the same issue when you go to $\pm\infty$. If your integration ranges are symmetric, you get $0$. This symmetric integration is the so called Cauchy principal value that @dxiv mentioned in the comment.