Prove the following
$$\int^\infty_0 \frac{\tan(x)}{x}=\frac{\pi}{2} $$
This question was posted on some forum, but i think it should be rewritten as $$PV\int^\infty_0 \frac{\tan(x)}{x}=\frac{\pi}{2} $$ Because if the discontinuoities of the zeros of $\cos(x)$.
My attempt
Consider the following function
$$f(x) = \frac{\tan(x)}{x}$$
On the interval $\left(-\frac{\pi}{2},\frac{\pi}{2} \right)$, clearly the function is symmetric and positive around the origin.
Let us consider $x \in \left(0,\frac{\pi}{2} \right)$
$$f'(x) = \frac{\sec^2(x) (2x - \sin(2 x))}{2x^2} > 0$$
Note that $\lim_{x\to 0} f(x) = 1$, we deduce that the function is increasing on the interval $\left(0,\frac{\pi}{2} \right)$. Hence
$$\int^{\pi/2}_{-\pi/2}\frac{\tan(x)}{x}\,dx = 2 \int^{\pi/2}_0 \frac{\tan(x)}{x}\,dx >2 \int^{\pi/2}_0\,dx = \pi$$ Also note that
Near $\pi/2$ the integral acts like $\frac{1}{\pi/2-x}$ which diverges to inifnity. The visual of $f$ is on that interval
From the graph of $f$ on the real line it seems the integrals on left and right are also divergent to -infinity and contribute to the infinity at the middle to cause a convergent value.
Question
I need a proof if the principal value exists or not?


Let $Z = \{k\pi +\frac{\pi}{2} : k \in \Bbb{Z}$ be the set of poles of $\tan x$ and define
$$ I(N,\epsilon) = \int\limits_{\substack{ \text{dist}(x,Z) > \epsilon \\ 0 < x < N\pi}} \frac{\tan x}{x} \, dx. $$
Then I will prove that
$$ \lim_{\substack{\epsilon &\to 0^+ \\ N&\to\infty}} I(N,\epsilon) = \frac{\pi}{2}. $$
Indeed, let $\epsilon \in (0,\pi/2)$. If we denote by $D(\epsilon) = \{x \in [0,\pi] : |x - \frac{\pi}{2}| > \epsilon \}$, then
\begin{align*} I(N,\epsilon) &= \frac{1}{2} \sum_{k=0}^{N-1} \int_{D(\epsilon)} \left( \frac{1}{x + k\pi} + \frac{1}{x - (k+1)\pi} \right) \tan x \, dx \\ &= \frac{1}{2} \int_{D(\epsilon)} \left( \sum_{k=0}^{N-1} \frac{2x-\pi}{(x + k\pi)(x - (k+1)\pi)} \right) \tan x \, dx \tag{*} \end{align*}
Here are several observations:
The function $f(x) = \dfrac{2x-\pi}{x(x-\pi)} \tan x$ extends to a bounded continuous function on $[0,\pi]$.
On the interval $(0,\pi)$, we have the following bound $$ \left|\frac{x(x-\pi)}{(x + k\pi)(x - (k+1)\pi)}\right| \leq \begin{cases} 1, & k = 0, \\ \frac{1}{k^2}, & k \geq 1 \end{cases} $$
This shows that the integrand of $\text{(*)}$ converges uniformly on $(0,\pi)$ to
$$ \lim_{N\to\infty} \sum_{k=0}^{N-1} \left( \frac{1}{x+k\pi} + \frac{1}{x-(k+1)\pi} \right) \tan x = \cot x \cdot \tan x = 1. $$
Therefore it follows that
$$ \lim_{\substack{\epsilon &\to 0^+ \\ N&\to\infty}} I(N,\epsilon) = \frac{1}{2}\int_{0}^{\pi} dx = \frac{\pi}{2}. $$
Addendum. In fact, the integrand of $\text{(*)}$ is always non-negative and monotone-increases to $1$ as $N \to \infty$:
Thus the same conclusion can be obtained by the monotone convergence theorem.