formula 3.749.2 from Gradshteyn & Ryzhik gives:

$$\int_0^{\infty}\frac{1-x\;{\rm cotan}x}{x^2+\epsilon^2}dx=\frac{\pi}{2\epsilon}-\frac{\pi}{e^{2\epsilon}-1}\quad{\rm for}\quad \epsilon>0.$$

taking the limit $\epsilon\downarrow 0$ gives your $\pi/2$; G&R do not explicitly say that their formula is a principal value integral, but it's the only sensible way to avoid the poles of the cotangent at $\pi,2\pi,...$; note that there is no singularity at $x=0$, so the limit $\epsilon\downarrow 0$ gives no ambiguity.

---------
Here's the derivation by contour integration, as promised. The integral over $1/(x^2+\epsilon^2)$ is elementary, so I only do the one involving the cotangent:

$${\cal P}\int_{0}^{\infty}dx\frac{x\;{\rm cotan}x}{x^2+\epsilon^2}=
\frac{1}{4}\lim_{\delta\rightarrow 0}\left(\int_{-\infty+i\delta}^{\infty+i\delta}dx\frac{x\;{\rm cotan}x}{x^2+\epsilon^2}+
\int_{-\infty-i\delta}^{\infty-i\delta}dx\frac{x\;{\rm cotan}x}{x^2+\epsilon^2}\right)$$

$$=\frac{1}{4}\lim_{\delta\rightarrow 0}\left(\int_{-\infty+i\delta}^{\infty+i\delta}\frac{dx}{\sin x}\frac{x\;e^{ix}}{x^2+\epsilon^2}+
\int_{-\infty-i\delta}^{\infty-i\delta}\frac{dx}{\sin x}\frac{x\;e^{-ix}}{x^2+\epsilon^2}\right)$$

$$=\frac{1}{4}\times 2\pi i\times 2\times \frac{1}{\sin i\epsilon}\frac{i\epsilon\;e^{-\epsilon}}{2i\epsilon}$$


$$=\frac{\pi}{e^{2\epsilon}-1}$$

In the first equality I inserted the definition of principal value; in the second equality I used that $xe^{\pm ix}/\sin x = x\;{\rm cotan}x\pm ix$ and the second term vanishes upon integration because it is an odd function of $x$; in the third equality I have closed the contour in the upper half of the complex plane for the first integral (picking up the pole at $x=i\epsilon$), and in the lower half of the complex plane for the second integral (pole at $x=-i\epsilon$). And so I arrive at the answer from Gradshteyn & Ryzhik, confirming that theirs was indeed a principal value result.