We make use of the identity
$$ \sum_{n=-\infty}^{\infty} \frac{1}{a^{2} - (x + n\pi)^{2}} = \frac{\cot(x+a) - \cot(x-a)}{2a}, \quad a > 0 \text{ and } x \in \Bbb{R}. $$
Then for $\alpha, \beta > 0$ it follows that
\begin{align*}
I := \mathrm{PV}\int_{0}^{\infty} \frac{\log\cos^{2}(\alpha x)}{\beta^{2} - x^{2}}
&= \frac{1}{2} \mathrm{PV} \int_{-\infty}^{\infty} \frac{\log\cos^{2}(\alpha x)}{\beta^{2} - x^{2}} \, dx \\
&= \frac{\alpha}{2} \mathrm{PV} \int_{-\infty}^{\infty} \frac{\log\cos^{2}x}{(\alpha\beta)^{2} - x^{2}} \, dx \\
&= \frac{\alpha}{2} \sum_{n=-\infty}^{\infty} \mathrm{PV} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\log\cos^{2}x}{(\alpha\beta)^{2} - (x+n\pi)^{2}} \, dx \\
&= \frac{\alpha}{2} \mathrm{PV} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \left( \sum_{n=-\infty}^{\infty} \frac{1}{(\alpha\beta)^{2} - (x+n\pi)^{2}} \right) \log\cos^{2}x \, dx \\
&= \frac{1}{4\beta} \mathrm{PV} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} (\cot(x+\alpha\beta) - \cot(x-\alpha\beta)) \log\cos^{2}x \, dx,
\end{align*}
where interchanging the order of integration and summation is justified by Tonelli's theorem applied to the summation over large indices $n$. Then
\begin{align*}
I
&= \frac{1}{4\beta} \mathrm{PV} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} (\cot(x+\alpha\beta) - \cot(x-\alpha\beta)) \log\cos^{2}x \, dx \\
&= \frac{1}{2\beta} \mathrm{PV} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} (\cot(x+\alpha\beta) - \cot(x-\alpha\beta)) \log\left|2\cos x\right| \, dx \tag{1}
\end{align*}
Here, we exploited the following identity to derive (1).
$$ \mathrm{PV} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \cot(x+a) \, dx = 0 \quad \forall a \in \Bbb{R}. $$
Now with the substitution $z = e^{2ix}$ and $\omega = e^{2i\alpha\beta}$, it follows that
\begin{align*}
I
&= \frac{1}{2\beta} \Re \mathrm{PV} \int_{|z|=1} \left( \frac{\bar{\omega}}{z - \bar{\omega}} - \frac{\omega}{z - \omega} \right) \log(1 + z) \, \frac{dz}{z}. \tag{2}
\end{align*}
Now consider the following unit circular contour $C$ with two $\epsilon$-indents $\gamma_{\omega,\epsilon}$ and $\gamma_{\bar{\omega},\epsilon}$.
![enter image description here](https://i.stack.imgur.com/EHpYV.png)
Then the integrand of (2)
$$ f(z) = \left( \frac{\bar{\omega}}{z - \bar{\omega}} - \frac{\omega}{z - \omega} \right) \frac{\log(1 + z)}{z} $$
is holomorphic inside $C$ (since the only possible singularity at $z = 0$ is removable) and has only logarithmic singularity at $z = -1$. So we have
$$ \oint_{C} f(z) \, dz = 0. $$
This shows that
\begin{align*}
I
&= \frac{1}{2\beta} \Re \lim_{\epsilon \downarrow 0} \left( \int_{-\gamma_{\omega,\epsilon}} f(z) \, dz + \int_{-\gamma_{\bar{\omega},\epsilon}} f(z) \, dz \right) \\
&= \frac{1}{2\beta} \Re \left( \pi i \mathrm{Res}_{z=\omega} f(z) + \pi i \mathrm{Res}_{z=\bar{\omega}} f(z) \right) \\
&= \frac{1}{2\beta} \Re \left( - \pi i \log(1 + \omega) + \pi i \log(1 + \bar{\omega}) \right) \\
&= \frac{\pi}{\beta} \arg(1 + \omega)
= \frac{\pi}{\beta} \arctan(\tan (\alpha \beta)).
\end{align*}
In particular, if $\alpha\beta < \frac{\pi}{2}$ then we have
$$ I = \pi \alpha. $$
But due to the periodicity of $\arg$ function, this function draws a scaled saw-tooth function for $\alpha > 0$. Of course, $I$ is an even function of both $\alpha$ and $\beta$, so the final result is obtained by even extension of this saw-tooth function.
Best Answer
As Lucian stated in the comments, integrating by parts shows that the integral is equivalent to showing that $$ \int_{0}^{\infty} \frac{x}{1+x^{2}} \frac{1}{\sinh \frac{\pi x}{2}} \ dx = \frac{\pi}{2}-1 .$$
Let $ \displaystyle f(z) = \frac{z}{1+z^{2}} \frac{1}{\sinh \frac{\pi z}{2}} $ and integrate around a rectangle with vertices at $\pm N$ and $\pm N+ i (2N+1)$ where $N$ is some positive integer.
As $N$ goes to infinity through the integers, the integral vanishes on the left and right sides of the rectangle and along the top of the rectangle.
In particular, the absolute value of the integral along the top of the rectangle is bounded by $$\frac{3N+1}{(2N+1)^{2}-1}\int_{-\infty}^{\infty} \frac{1}{\cosh \frac{\pi x}{2}} \ dx = \frac{6N+2}{(2N+1)^{2}-1} \to 0 \ \text{as} \ N \to \infty .$$
Then
$$\int_{-\infty}^{\infty} \frac{x}{1+x^{2}} \frac{1}{\sinh \frac{\pi x}{2}} \ dx = 2 \pi i \left(\text{Res}[f(z),i]+ \sum_{k=1}^{\infty} \text{Res}[f(z),2ki] \right)$$
where
$$ \text{Res}[f(z),i] = \lim_{z \to i} \frac{z}{z+i} \frac{1}{\sinh \frac{\pi x}{2}} =\frac{1}{2i}$$
and
$$ \text{Res}[f(z),2ki] = \lim_{z \to 2ki} \frac{z}{2z \sinh \frac{\pi z}{2}+(1+z^{2}) \frac{\pi}{2} \cosh \frac{\pi z}{2}} = \frac{4i}{\pi} \frac{(-1)^{k} k}{1-4k^{2}} . $$
And notice that
$$ \begin{align} \sum_{k=1}^{\infty} \frac{(-1)^{k} k}{1-4k^{2}} &= -\frac{1}{4} \sum_{k=1}^{\infty} \left( \frac{(-1)^{k}}{2k+1} + \frac{(-1)^{k}}{2k-1} \right) \\ &= -\frac{1}{4} \left(\arctan(1)-1 - \arctan(1) \right) \\ &= \frac{1}{4} . \end{align}$$
Therefore,
$$ \int_{-\infty}^{\infty} \frac{x}{1+x^{2}} \frac{1}{\sinh \frac{\pi x}{2}} \ dx = 2 \pi i \left(\frac{1}{2i} + \frac{i}{\pi} \right) = \pi - 2$$
which implies
$$ \int_{0}^{\infty} \frac{x}{1+x^{2}} \frac{1}{\sinh \frac{\pi x}{2}} \ dx = \frac{\pi}{2} -1 .$$