EDIT: I modified the contour slightly.
Similar to the answer HERE, we can integrate the complex function $$f(z) = \frac{e^{i \tan z}}{z} $$ around a rectangular contour with vertices at $z= N$, $z=N+i\sqrt{N}$, $z= -N + i \sqrt{N}$, and $z=-N$, where $N$ is some positive integer.
Due to the presence of a simple pole at the origin and essential singularities at the half-integers, the contour needs to be indented along the real axis.
But since $$|e^{i \tan z}| = |e^{i \tan (x+iy)}| =\exp \left(-\frac{\sinh 2y}{\cos 2x + \cosh 2y} \right) \le 1$$ in the upper half-plane, the total contribution from the indentations around the essential singularities is vanishingly small.
Also, since the height of the contour is $\sqrt{N}$ and the magnitude of $e^{i \tan z}$ is bounded in the upper half-plane, the estimation lemma tells us that integrals along the sides of the rectangle vanish as $N \to \infty$.
So letting the radius of the indentation around the origin go to zero and then letting $N \to \infty$, we get
$$ \text{PV} \int_{-\infty}^{\infty} \frac{e^{i \tan x}}{x} \, dx - i \pi \,\text{Res}[f(z),0] -\lim_{N \to \infty} \int_{-N}^{N} \frac{e^{i \tan (t+i\sqrt{N})}}{t+i\sqrt{N}} \, dt =0. $$
But since the magnitude of $e^{i \tan z}- \frac{1}{e}$ tends to zero exponentially fast as $\Im(z) \to +\infty$, we can replace $e^{i \tan(t+ i \sqrt{N})}$ with $\frac{1}{e}$. (Specifically, it's going to zero like $\frac{2}{e} e^{-2 \, \Im(z)}$.)
So we have
$$\text{PV} \int_{-\infty}^{\infty} \frac{e^{i \tan x}}{x} \, dx - i \pi - \frac{1}{e} \lim_{N \to \infty} \int_{-N}^{N} \frac{1}{t+i\sqrt{N}} \, dt =0. $$
But if we integrate $g(z) = \frac{1}{z}$ around a similar contour, we get
$$ \underbrace{\text{PV} \int_{-\infty}^{\infty} \frac{dx}{x}}_{0} - i \pi \underbrace{\text{Res}[g(z),0]}_{1} - \lim_{N \to \infty} \int_{-N}^{N} \frac{1}{t+i\sqrt{N}} \, dt = 0.$$
Therefore,
$$ \text{PV} \int_{-\infty}^{\infty} \frac{e^{i \tan x}}{x} \, dx - i \pi - \frac{1}{e} (-i \pi) =0.$$
The result then follows if we equate the imaginary parts on both sides of the equation.