How to find PV $\int_0^\infty \frac{\log \cos^2 \alpha x}{\beta^2-x^2} \, \mathrm dx=\alpha \pi$ $$
I:=PV\int_0^\infty \frac{\log\left(\cos^2\left(\alpha x\right)\right)}{\beta^2-x^2} \, \mathrm dx=\alpha \pi,\qquad \alpha>0,\  \beta\in \mathbb{R}.$$
I am trying to solve this integral, I edited and added in Principle value to clarify the convergence issue that the community pointed out.  I tried to use $2\cos^2(\alpha x)=1+\cos 2\alpha x\,$ and obtained
$$
I=-\log 2 \int_0^\infty \frac{\mathrm dx}{\beta^2-x^2}+\int_0^\infty \frac{\log (1+\cos 2 \alpha x)}{\beta^2-x^2}\mathrm dx,
$$
simplifying
$$
I=\frac{ \pi \log 2 }{2\beta}+\int_0^\infty \frac{\log (1+\cos 2 \alpha x)}{\beta^2-x^2}\mathrm dx
$$
but  stuck here. Note the result of the integral is independent of the parameter $\beta$. Thank you
Also for $\alpha=1$, is there a geometrical interpretation of this integral and why it is $\pi$?
Note this integral 
$$
\int_0^\infty \frac{\log \sin^2 \alpha x}{\beta^2-x^2} \,\mathrm dx=\alpha \pi-\frac{\pi^2}{2\beta},\qquad \alpha>0,\beta>0
$$
is also FASCINATING, note the constraint $\beta>0$ for this one.  I am not looking for a solution to this too obviously on the same post, it is just to interest people with another friendly integral.
 A: 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}$.

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.
A: Consider the function $$ f(z) = \frac{\log(1+e^{2i \alpha z})}{z^{2}-\beta^{2}} \ , \ (\alpha,\beta >0)$$
which is well-defined on the complex plane if we omit the real axis and restrict $z$ to the upper half-plane while defining $\log (1+e^{2iaz})$ to be $\log(2)$ just above the origin.
Notice that  $$\text{Re} \big( f(x) \big) = \frac{1}{2} \frac{\log(2+2 \cos 2 \alpha x)}{x^{2}-\beta^{2}} = \frac{1}{2} \frac{\log \big(4 \cos^{2} ( \alpha x) \big)}{x^{2}-\beta^{2}}.$$
Now integrate around a contour that consists of the line segment just above the line segment $[-R,R]$ (with half-circle indentations of radius $r$ around the branch points at $z= \frac{(2n+1)\pi}{2 \alpha}$ and the simple poles at $z = \pm \beta$) and the upper half of the circle $|z|=R$.
Along the upper half of $|z|=R$, $\log(1+e^{2iaz}) \to 0$ as $R \to \infty$. So the integral clearly vanishes along there as $R \to \infty$.
And since $\lim_{z \to \frac{(2n+1)\pi}{2 \alpha}}\left(z- \frac{(2n+1)\pi}{2 \alpha} \right) f(z) = 0$, the contributions from the indentations around the branch points vanish as $r \to 0$.
So we have
$$\begin{align}  \text{PV} \int_{-\infty}^{\infty} \frac{\log \left(4 \cos^{2}( \alpha x)\right)}{\beta^{2}-x^{2}} \ dx &= -2 \ \text{Re} \ \text{PV} \int_{-\infty}^{\infty} \frac{\log(1+e^{2i \alpha x})}{x^{2}-\beta^{2}} \ dx \\ &= -2 \ \text{Re} \Big( i \pi \ \text{Res}[f(z),\beta)] + i \pi \ \text{Res}[f(z),-\beta)]\Big) \\ &= - 2 \ \text{Re} \ i \pi  \Big(\frac{\log(1+e^{2i \alpha \beta})}{2 \beta} + \frac{\log(1+e^{-2i \alpha \beta})}{-2 \beta} \Big) \\ &= \frac{2\pi}{\beta} \left[\arctan\Big(\frac{\sin 2 \alpha \beta}{1+\cos 2 \alpha \beta}\Big) \right] \\ &= \frac{2 \pi}{\beta} \arctan \left(\tan ( \alpha \beta) \right) , \end{align}$$
which implies
$$ \log(4) \ \text{PV} \int_{-\infty}^{\infty} \frac{1}{\beta^{2}-x^{2}} \ dx + \text{PV} \int_{-\infty}^{\infty} \frac{\log \cos^{2}(\alpha x)}{\beta^{2}-x^{2}} \ dx = \frac{2 \pi}{\beta} \arctan \left( \tan (\alpha \beta) \right).$$
But $$\text{PV} \int_{-\infty}^{\infty} \frac{1}{\beta^{2}-x^{2}} \ dx =0$$
since the residues at $\pm \beta$ cancel each other.
Therefore,
$$ \text{PV} \int_{0}^{\infty} \frac{\log \cos^{2}(\alpha x)}{\beta^{2}-x^{2}} \ dx =  \frac{\pi}{\beta} \arctan \left(\tan (\alpha \beta) \right).$$
And if $\alpha \beta < \frac{\pi}{2}$, $$ \text{PV} \int_{0}^{\infty} \frac{\log \cos^{2}(\alpha x)}{\beta^{2}-x^{2}} \ dx = \frac{\pi}{\beta} \left(\alpha \beta \right) =\pi \alpha.$$
A: Let us use the contour $\gamma$ which is the limit as $R\to\infty$ and $r\to0$ of
$$
[-R,-\beta-r]\cup-\beta+re^{i[\pi,0]}\cup[-\beta+r,\beta-r]\cup\beta+re^{i[\pi,0]}\cup[\beta+r,R]\cup Re^{i[0,\pi]}
$$
$\hspace{3.5cm}$
to compute
$$
\begin{align}
&PV\int_{-\infty}^\infty\frac{\cos(\alpha x)}{\beta^2-x^2}\mathrm{d}x\\
&=PV\int_{-\infty}^\infty\frac{e^{i\alpha x}}{\beta^2-x^2}\mathrm{d}x\\
&=\int_\gamma\frac{e^{i\alpha z}}{\beta^2-z^2}\mathrm{d}z+\pi i\operatorname*{Res}_{z=-\beta}\left(\frac{e^{i\alpha z}}{\beta^2-z^2}\right)+\pi i\operatorname*{Res}_{z=\beta}\left(\frac{e^{i\alpha z}}{\beta^2-z^2}\right)\\
&=0+\pi i\frac{e^{-i\alpha\beta}}{2\beta}-\pi i\frac{e^{i\alpha\beta}}{2\beta}\\[6pt]
&=\frac\pi\beta\sin(\alpha\beta)
\end{align}
$$
where $\alpha\ge0$ (needed so that the integral vanishes along the large arc); however, the principal value integral is even in $\alpha$.
Setting $\alpha=0$ gives
$$
PV\int_{-\infty}^\infty\frac1{\beta^2-x^2}\mathrm{d}x=0
$$

Now we can use that
$$
\log\left(\cos^2(\alpha x)\right)=-2\log(2)+2\sum_{k=1}^\infty\frac{(-1)^{k-1}}{k}\cos(2k\alpha x)
$$
to get, for $\alpha\ge0$,
$$
\begin{align}
\int_0^\infty\frac{\log\left(\cos^2(\alpha x)\right)}{\beta^2-x^2}\mathrm{d}x
&=\frac12\int_{-\infty}^\infty\frac{\log\left(\cos^2(\alpha x)\right)}{\beta^2-x^2}\mathrm{d}x\\
&=\frac\pi\beta\sum_{k=1}^\infty\frac{(-1)^{k-1}}{k}\sin(2k\alpha\beta)\\
&=\frac\pi\beta\frac1{2i}\sum_{k=1}^\infty\frac{(-1)^{k-1}}{k}\left(e^{2ik\alpha\beta}-e^{-2ik\alpha\beta}\right)\\
&=\frac\pi\beta\frac1{2i}\left(\log\left(1+e^{2i\alpha\beta}\right)-\log\left(1+e^{-2i\alpha\beta}\right)\right)
\end{align}
$$

Note that
$$
\theta(\alpha,\beta)=\frac\pi\beta\frac1{2i}\left(\log\left(1+e^{2i\alpha\beta}\right)-\log\left(1+e^{-2i\alpha\beta}\right)\right)
$$
is an odd function of $\alpha$ with a period of $\frac\pi{|\beta|}$ and equals $\pi\alpha$ for $|\alpha|\lt\frac\pi{2|\beta|}$. Furthermore, in general,
$$
\int_0^\infty\frac{\log\left(\cos^2(\alpha x)\right)}{\beta^2-x^2}\mathrm{d}x=\theta(|\alpha|,\beta)
$$
and $\theta(|\alpha|,\beta)=\pi|\alpha|$ for $|\alpha|\le\frac\pi{2|\beta|}$.
Thus, the integral is not totally independent of $\beta$.
