Prove $\int_0^\infty \frac{\ln \tan^2 (ax)}{1+x^2}\,dx = \pi\ln \tanh(a)$ $$
\mbox{How would I prove}\quad
\int_{0}^{\infty}
{\ln\left(\,\tan^{2}\left(\, ax\,\right)\,\right) \over 1 + x^{2}}\,{\rm d}x
=\pi
\ln\left(\,\tanh\left(\,\left\vert\, a\,\right\vert\,\right)\,\right)\,{\Large ?}.
\qquad a \in {\mathbb R}\verb*\* \left\{\,0\,\right\}
$$
 A: By equating the real parts on both sides of the identity $$\sum_{k=1}^{\infty} \frac{(be^{i \theta })^{k}}{k} = -\log(1-be^{i  \theta}) \ , \ |b| < 1,$$ one finds that $$ \sum_{k=1}^{\infty} \frac{b^{k} \cos k\theta }{k} = - \frac{1}{2} \log \left(1-2b \cos \theta +b^{2} \right).$$
Then for $a >0$, $$ \begin{align}\int_{0}^{\infty} \frac{\log(1-2b \cos 2ax +b^{2})}{1+x^{2}} \ dx &= -2\int_{0}^{\infty}\frac{1}{1+x^{2}}\sum_{k=1}^{\infty} \frac{b^{k} \cos (2akx)}{k} \\ &=-2 \sum_{k=1}^{\infty} \frac{b^{k}}{k}\int_{0}^{\infty} \frac{\cos  (2ak x)}{1+x^{2}} \ dx \\ &=-\pi \sum_{k=1}^{\infty} \frac{(be^{-2a})^{k}}{k} \\ &= \pi \log(1-be^{-2a}). \end{align}$$
Letting $b \to 1^{-}$, $$ \int_{0}^{\infty} \frac{\log (4 \sin^{2} ax)}{1+x^{2}} \ dx = \pi \log(1-e^{-2a}). \tag{1}$$
While letting $b \to -1^{+}$, $$\int_{0}^{\infty} \frac{\log(4 \cos^{2} ax)}{1+x^{2}} \ dx = \pi\log(1+e^{-2a}). \tag{2}$$
Then subtracting $(2)$ from $(1)$, $$ \int_{0}^{\infty} \frac{\log (\tan^{2} ax)}{1+x^{2}} \ dx = \pi \log \left(\frac{1-e^{-2a}}{1+e^{-2a}} \right) =\pi \log( \tanh a) .$$
A: Here is another solution:
We remark that
$$ \log\tan^{2}\theta = -4 \sum_{n \ \mathrm{odd}}^{\infty}\frac{1}{n}\cos 2n\theta \tag{1} $$
and
$$ \sum_{n \ \mathrm{odd}}^{\infty} \frac{1}{n} x^{n} = \frac{1}{2}\log\left(\frac{1+x}{1-x}\right). \tag{2} $$
Both are easily proved by using Euler's formula $e^{i\theta} = \cos\theta + i\sin\theta$ and the Taylor series of the logarithm. Also we note that
$$ \int_{0}^{\infty} \frac{t \sin t}{a^2 + t^2} \, dt = \frac{\pi}{2} e^{-|a|}. \tag{3}$$
Then
\begin{align*}
\int_{0}^{\infty} \frac{\log\tan^2(ax)}{1+x^2} \, dx
&= \int_{0}^{\infty} \log\tan^2(ax) \left( \int_{0}^{\infty} \sin t \, e^{-xt} \, dt \right) \, dx \\
&= \int_{0}^{\infty} \sin t \int_{0}^{\infty} e^{-tx} \log\tan^2(ax) \, dxdt \\
&= -4 \int_{0}^{\infty} \sin t \int_{0}^{\infty} \sum_{n \ \mathrm{odd}}^{\infty}\frac{1}{n} e^{-tx} \cos (2nax) \, dxdt \\
&= -4 \int_{0}^{\infty} \sin t \sum_{n \ \mathrm{odd}}^{\infty}\frac{1}{n} \frac{t}{4a^{2}n^{2} + t^{2}} \, dt \\
&= -4 \sum_{n \ \mathrm{odd}}^{\infty} \frac{1}{n} \int_{0}^{\infty} \frac{t \sin t}{4a^{2}n^{2} + t^{2}} \, dt \\
&= -2\pi \sum_{n \ \mathrm{odd}}^{\infty} \frac{1}{n} e^{-2an}
 = \pi \log \left( \frac{1-e^{-2a}}{1+e^{-2a}} \right) \\
&= \pi \log (\tanh a).
\end{align*}
A: An idea with complex contour. Let us choose the path
$$C_R:=[-R,R]\cup\gamma_R:=\{z\in\Bbb C\;;\;z=Re^{it}\,\,,\,0\leq t\leq \pi\}\,\,,\,0<<R\in\Bbb R$$
Take the function 
$$f(z):=\frac{\operatorname{Log}(\tan^2az)}{1+z^2}=2\frac{\operatorname{Log}(\tan az)}{1+z^2}$$
Inside the domain enclosed by $\,C_R\,$ above, the function has the pole $\,z=i\,$ (note that at the poles of $\,\tan az\,$ the logarithmic function equals $\,0+\arg(\text{pole})\,$ , and since we're going to choose the branch along the cut from zero to $\,-i\infty \,$ , i.e. the negative y-axis all these give us zero, so we're left only with the zero of the denominator in the positive half complex plane:
$$Res_{z=i}(f)=2\lim_{z\to i}(z-i)\frac{\operatorname{Log}(\tan az)}{z^2+1}=2\frac{\operatorname{Log}(\tan ai)}{2i}=-i\log(\tanh a)$$
We also have that
$$\left|\int_{\gamma_R}2\frac{\operatorname{Log}(\tan az)}{1+z^2}dz\right|\leq2\frac{|\log|\tan az||}{1-R^2}R\pi\xrightarrow[R\to\infty]{}0$$
as using the form (with $\,z=x+yi\,\,,\,x,y\in\Bbb R\,\,,\,y>0\,$)
$$\tan az=\frac{e^{2aiz}-1}{e^{2aiz}+1}\Longrightarrow |\log|\tan az||\leq \left|\log\frac{1+e^{2iy}}{1-e^{2iy}}\right|\xrightarrow [y\to\infty]{}\log 1=0$$
Thus, we finally get by Cauchy's Theorem
$$2\pi i(-i\log(\tanh a))=2\pi\log(\tanh a)=\oint_{C_R} f(z)\,dz=$$
$$=\int\limits_{-R}^R\frac{\log(\tan^2 ax)}{1+x^2}dx+\int_{\gamma_R}f(z)\,dz\xrightarrow[R\to\infty]{}\int\limits_{-\infty}^\infty\frac{\log(\tan^2 x)}{1+x^2}dx$$
Now just divide by two the integral of the even function above and we're done.
A: Denote the evaluated integral as $I$, then $I$ may be rewritten as
$$I=\int_0^\infty \frac{\ln \sin^2 ax}{1+x^2}\,dx-\int_0^\infty \frac{\ln \cos^2 ax}{1+x^2}\,dx$$
Using Fourier series representations of $\ln \sin^2 \theta$ and $\ln \cos^2 \theta$,
$$\ln \sin^2 \theta=-2\ln2-2\sum_{k=1}^\infty \frac{\cos2k\theta}{k}$$
and
$$\ln \cos^2 \theta=-2\ln2+2\sum_{k=1}^\infty (-1)^{k+1}\frac{\cos2k\theta}{k}$$
also note that
$$\int_0^\infty\frac{\cos bx}{1+x^2}\,dx=\frac{\pi e^{-b}}{2}$$
then
$$\begin{align}I&=-2\sum_{k=1}^\infty \frac{1}{k}\int_0^\infty\frac{\cos2kax}{1+x^2}\,dx-2\sum_{k=1}^\infty \frac{(-1)^{k+1}}{k}\int_0^\infty\frac{\cos2kax}{1+x^2}\,dx\\&=-\pi\sum_{k=1}^\infty \frac{e^{-2ak}}{k}-\pi\sum_{k=1}^\infty (-1)^{k+1}\frac{e^{-2ak}}{k}\\&=\pi\ln\left(1-e^{-2a}\right)-\pi\ln\left(1+e^{-2a}\right)\\&=\pi\ln\left(\frac{1-e^{-2a}}{1+e^{-2a}}\right)\\&=\pi\ln\left(\tanh a\right)\end{align}$$
A: Another approach. We may assume $a>0$, then:
$$ I = \int_{0}^{+\infty}\frac{\log\tan^2(ax)}{1+x^2}\,dx = a\int_{0}^{+\infty}\frac{\log\tan^2(x)}{a^2+x^2}\,dx \tag{1}$$
and since $\log\tan^2(x)$ is a $\pi$-periodic function,
$$\begin{eqnarray*} I &=& a \int_{0}^{\pi}\log\tan^2(x)\sum_{k\geq 0}\frac{1}{a^2+(x+k\pi)^2}\,dx\\&=&a\int_{0}^{\pi/2}\log\tan^2(x)\sum_{k\geq 0}\left(\frac{1}{a^2+(x+k\pi)^2}+\frac{1}{a^2+(\pi-x+k\pi)^2}\right)\,dx\\&=&2a\int_{0}^{\pi/2}\log\tan(x)\,\frac{\coth(a-ix)+\coth(a+ix)}{2a}\,dx\tag{2} \end{eqnarray*}$$
where the last identity comes from considering the logarithmic derivative of the Weierstrass product for the $\sinh$ function. Now the substitution $x=\arctan t$ brings that integral into:
$$\begin{eqnarray*} && 2\int_{0}^{+\infty}\frac{\log(t)}{1+t^2}\cdot\frac{\sinh(a)\cosh(a)+t^2\sinh(a)\cosh(a)}{\sinh(a)^2+t^2\cosh(a)^2}\,dt\\&=&\int_{0}^{+\infty}\frac{2\sinh(a)\cosh(a)\log(t)\,dt}{\sinh(a)^2+t^2\cosh^2(a)} \tag{3}\end{eqnarray*}$$
that is an elementary integral, just depending on:

$$ \int_{0}^{+\infty}\frac{\log(t)}{1+A^2 t^2}\,dt = \color{red}{-\frac{\pi\log(A)}{2A}}\tag{4} $$

that holds by a symmetry argument.

This is just a small variation on a one-line proof of $\int_{-\infty}^{+\infty}\frac{\sin x}{x}\,dx=\pi$:

$$ \begin{eqnarray*}\int_{-\infty}^{+\infty}\frac{\sin x}{x}\,dx = \int_{-\pi/2}^{\pi/2}\sin(z)\sum_{m\in\mathbb{Z}}\frac{(-1)^m}{z+\pi m}\,dz=\int_{-\pi/2}^{\pi/2}\sin(z)\csc(z)\,dz = \color{red}{\pi}.\end{eqnarray*}$$

A: Another approach:
$$ I(a) = \int_{0}^{+\infty}\frac{\log\tan^2(ax)}{1+x^2}\,dx$$
first use "lebniz integral differentiation"
and then do change of variable to calculate the integral.
Hope it helps.
