Conjectured value of $\int_{0}^{\infty}\left(\frac{x-1}{\ln^2 x}-\frac{1}{\ln x}\right)\frac{\mathrm{d}x}{x^2+1}$

It is not necessary to exploit any symmetries of the integrand. Setting $x=e^y$

$$ I=\int_{-\infty}^{\infty}\underbrace{e^y\left(\frac{e^y-1}{y^2}-\frac{1}{y}\right)\frac{1}{e^{2y}+1}}_{f(y)}\,dy $$

Integrating around a big semicircle in the UHP (exercise: show convergence in this domain of the complex plane) we obtain

$$ I=2 \pi i \sum_{n=0}^{\infty}\text{Res}(f(z),z=z_n) $$ here $z_n=\frac{i\pi}2(2n+1)$. This is easily rewritten as

$$ I=2 \pi i\left(\left(\frac{1}{\pi}\color{blue}{\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}}-\frac{2}{\pi^2}\color{red}{\sum_{n=0}^{\infty}\frac{1}{(2n+1)^2}}\right) -\frac{2i}{\pi^2}\color{green}{\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)^2}}\right) $$

since $\color{blue}{\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}=\frac{\pi}{4}}$ and $\color{red}{\sum_{n=0}^{\infty}\frac{1}{(2n+1)^2}=\frac{\pi^2}{8}}$ the imaginary parts cancel and we are left with

$$ I= \frac{4}{\pi}\color{green}{\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)^2}}=\frac{4\color{green}{K}}{\pi} $$


Our integral equals

$$ I=\int_{-\infty}^{+\infty}\left(\frac{e^t-1-t}{t^2}\right)\frac{e^t}{e^{2t}+1}\,dt $$ that by exploiting symmetry becomes $$ I = \int_{0}^{+\infty}\frac{e^{t}+e^{-t}-2}{t^2(e^{t}+e^{-t})}\,dt =\int_{0}^{+\infty}\frac{\cosh(t)-1}{t^2\cosh(t)}\,dt$$ The last integral is straightforward to compute trough the residue theorem. Since $$ \text{Res}\left(\frac{\cosh(t)-1}{t^2\cosh(t)},t=\frac{\pi(2k+1)}{2}i\right)= (-1)^{k+1}\frac{4i}{\pi^2(2k+1)^2}$$ we have: $$\boxed{ I = \frac{4}{\pi}\sum_{k\geq 0}\frac{(-1)^k}{(2k+1)^2}=\color{red}{\frac{4G}{\pi}}}$$

as conjectured.


Here is yet another approach. We first note that we can write $\frac{x-1}{\log(x)}$ as

$$\frac{x-1}{\log(x)}=\int_0^1 x^t\,dt$$

Therefore, we can write

$$\begin{align} \int_0^\infty \left(\frac{x-1}{\log^2(x)}-\frac{1}{\log(x)}\right)\frac{1}{1+x^2}\,dx&=\int_0^\infty \int_0^1 \frac{x^t-1}{\log(x)}\,\frac{1}{1+x^2}\,dt\,dx\\\\ &=\int_0^1 \int_0^\infty \frac{x^t-1}{\log(x)}\,\frac{1}{1+x^2}\,dx\,dt\tag1 \end{align}$$

Let $I(t)$ represent the inner integral of the right-hand side of $(1)$. Then, differentiating, we find that

$$\begin{align} I'(t)&=\int_0^\infty \frac{x^t}{1+x^2}\,dx\\\\ &=\frac{\pi}{2\cos(\pi t/2)}\tag 2 \end{align}$$

where I derived the right-hand side of $(2)$ in THIS ANSWER. Alternatively, using real analysis only, we have

$$\begin{align} \int_0^\infty \frac{x^t}{1+x^2}\,dx&=\frac12 B\left(\frac{1+t}{2},\frac{1-t}{2}\right)\\\\ &=\frac12 \Gamma\left(\frac{1+t}{2}\right)\Gamma\left(\frac{1-t}{2}\right)\\\\ &=\frac12\frac{\pi}{\sin\left(\pi\frac{1+t}{2}\right)}\\\\ &=\frac{\pi}{2\cos(\pi t/2)} \end{align}$$

Integrating $(2)$ and using $I(0)=0$ reveals

$$I(t)=\int_0^t \frac{\pi}{2\cos(\pi t'/2)}\,dt' \tag 3$$

Substituting $(3)$ into $(1)$ yields

$$\begin{align} \int_0^\infty \left(\frac{x-1}{\log^2(x)}-\frac{1}{\log(x)}\right)\frac{1}{1+x^2}\,dx&=\frac{\pi}{2}\int_0^1 \int_0^t \sec(\pi t'/2)\,dt'\,dt \tag 4\\\\ &=\frac{\pi}{2}\int_0^1 (1-t)\sec(\pi t/2)\,dt \tag5\\\\ &=\frac{\pi}{2}\int_0^1 t\csc(\pi t/2)\,dt \tag 6\\\\ &=\frac{1}{\pi}\int_{-\pi/2}^{\pi/2}\frac{t}{\sin(t)}\,dt \tag 7\\\\ &=\frac{4G}{\pi} \tag 8 \end{align}$$

as was to be shown!


NOTES:

In going from $(4)$ to $(5)$, we changed the order of integration and carried out the inner integral.

In going from $(5)$ to $(6)$, we enforced the substitution $t \to 1-t$.

In going from $(6)$ to $(7)$, we enforced the substitution $t \to 2t/\pi$ and exploited the evenness of the integrand.

In going from $(7)$ to $(8)$, we made use of one of the integral identities for Catalan's Constant as found HERE.


ALTERNATIVE DEVELOPMENT

Note that we can write $(3)$ as

$$I(t)=\log\left(\cot\left(\frac{\pi}{4}(1-t)\right)\right) \tag 9$$

Then, substituting $(9)$ into $(1)$ yields

$$\begin{align} \int_0^\infty \left(\frac{x-1}{\log^2(x)}-\frac{1}{\log(x)}\right)\frac{1}{1+x^2}\,dx&=\int_0^1 \log\left(\cot\left(\frac{\pi}{4}(1-t)\right)\right)\,dt \\\\ &=\frac{4}{\pi}\int_0^{\pi/4} \log(\cot(t))\,dt \tag 9\\\\ &=\frac{4G}{\pi} \end{align}$$

which uses another well-known integral identity for $G$ as found HERE.

Note that if we enforce the substitution $t\to \text{arccot}(t)$ in $(9)$, we find the result in terms of the series representation of $G$ as

$$\begin{align} \int_0^\infty \left(\frac{x-1}{\log^2(x)}-\frac{1}{\log(x)}\right)\frac{1}{1+x^2}\,dx&=\frac{4}{\pi}\int_0^{\pi/4} \log(\cot(t))\,dt \\\\ &=\frac{4}{\pi}\int_1^{\infty}\frac{\log(t)}{1+t^2}\,dt\\\\ &=-\frac{4}{\pi}\int_0^1 \frac{\log(t)}{1+t^2}\,dt\\\\ &=-\frac{4}{\pi}\sum_{n=0}^\infty(-1)^n \int_0^1 t^{2n}\log(t)\,dt\\\\ &=\frac{4}{\pi}\sum_{n=0}^\infty(-1)^n \int_0^1 \frac{t^{2n}}{2n+1}\,dt\\\\ &=\frac{4}{\pi}\sum_{n=0}^\infty(-1)^n \frac{1}{(2n+1)^2}\\\\ &=\frac{4G}{\pi} \end{align}$$

as expected once again!