Evaluate $\int_0^1\left(\frac{1}{\ln x} + \frac{1}{1-x}\right)^2 \mathrm dx$ Evaluate
$$\int_0^1\left(\frac{1}{\ln x} + \frac{1}{1-x}\right)^2 \mathrm dx$$

New answer (Jun 6, 2022). About 9 and half years since my first solution, it suddenly dawned on me that I can compute this integral in another way:
Note that, for $0 < x < 1$,
$$ \frac{1}{1-x} + \frac{1}{\log x} = \int_{0}^{1} \frac{1-x^s}{1-x} \, \mathrm{d}s. $$
Plugging this to OP's integral and interchanging the order of integration, we get
\begin{align*}
I := \int_{0}^{1} \left( \frac{1}{1-x} + \frac{1}{\log x} \right)^2 \, \mathrm{d}x
&= \int_{0}^{1}\int_{0}^{1} \int_{0}^{1} \frac{1-x^s}{1-x} \cdot \frac{1-x^t}{1-x} \, \mathrm{d}x \, \mathrm{d}s \,\mathrm{d}t
\end{align*}
Let us study the innermost integral. Performing integration by parts,
\begin{align*}
&\int_{0}^{1} \frac{1-x^s}{1-x} \cdot \frac{1-x^t}{1-x} \, \mathrm{d}x \\
&= \underbrace{\left[ \frac{x}{1-x}(1-x^s)(1-x^t) \right]_{x=0}^{x=1}}_{=0} - \int_{0}^{1} \frac{(s+t)x^{s+t} - sx^s - tx^t}{1-x} \, \mathrm{d}x \\
&= (s+t)\psi_0(s+t+1) - s\psi_0(s+1) - t\psi_0(t+1), \tag{1}
\end{align*}
where $\psi_0(\cdot)$ is the digamma function and we utilized its integral representation in the last step. To make use of this formula, note that the change of variables $(x, y) = (s+t, s-t)$ yields
$$ \forall f \in C([0,2]) \ : \quad \int_{0}^{1}\int_{0}^{1} f(s+t) \, \mathrm{d}s\mathrm{d}t
= \int_{0}^{1} x[f(x) + f(2-x)] \, \mathrm{d}x. $$
Using this and by integrating both sides of $\text{(1)}$, we get
\begin{align*}
I
&= \int_{0}^{1} x \bigl[ x \psi(x+1) + (2-x)\psi(3-x) \bigr] \, \mathrm{d}x - 2 \int_{0}^{1} x \psi(x+1) \, \mathrm{d}x \\
&= \int_{0}^{1} x(2-x) \bigl[ \psi(3-x) - \psi(x+1) \bigr] \, \mathrm{d}u \\
&= \int_{0}^{1} x(2-x) \left[ \frac{1}{2-x} + \psi(2-x) - \psi(x+1) \right] \, \mathrm{d}u \\
&= \frac{1}{2} + 2 \int_{0}^{1} (1-x) \log ( \Gamma(2-x)\Gamma(x+1)) \, \mathrm{d}x \tag{int. by parts}
\end{align*}
By noting that $\log ( \Gamma(2-x)\Gamma(x+1))$ is symmetric about $x = \frac{1}{2}$ and using the reflection formula, this further reduces to
\begin{align*}
I
&= \frac{1}{2} + \int_{0}^{1} \log ( \Gamma(2-x)\Gamma(x+1)) \, \mathrm{d}x \tag{by symmetry} \\
&= \frac{1}{2} + \int_{0}^{1} \left( \log(1-x) + \log x + \log \pi - \log\sin(\pi x) \right) \, \mathrm{d}x \\
&= \bbox[color:navy;padding:5px;border:1px dotted navy;]{\log(2\pi) - \frac{3}{2}}
\end{align*}

Old answer (Jan 18, 2013). Here is an another approach using the principle of analytic continuation:
Let $I$ denote the integral. Applying the substitution $x = e^{-t}$, the integral is recast as
\begin{align*} I
&= \int_{0}^{\infty} \left\{ \frac{1}{(1-e^{-t})^{2}} - \frac{2}{t(1-e^{-t})} + \frac{1}{t^2} \right\} e^{-t} \, \mathrm{d}t \\
&= \int_{0}^{\infty} \left\{ \frac{e^{t}}{(e^{t} - 1)^{2}} - \frac{1}{t^2} \right\} \, \mathrm{d}t + \int_{0}^{\infty} \left\{ \frac{1 + e^{-t}}{t^2} - \frac{2}{t(e^{t}-1)} \right\} \, \mathrm{d}t.
\end{align*}
It is easy to observe that the first integral evaluates as
\begin{align*}
\int_{0}^{\infty} \left\{ \frac{e^{t}}{(e^{t} - 1)^{2}} - \frac{1}{t^2} \right\} \, \mathrm{d}t
&= \left[ \frac{1}{t} - \frac{1}{e^{t} - 1} \right]_{0}^{\infty}
= -\frac{1}{2}.
\end{align*}
We thus focus on the second integral. We do so by first introducing the regularized version
$$ F(s) := \int_{0}^{\infty} \left\{ \frac{1 + e^{-t}}{t^2} - \frac{2}{t(e^{t}-1)} \right\} e^{-st} \, \mathrm{d}t. $$
Differentiating $F(s)$ twice, we get
\begin{align*}F''(s)
&= \int_{0}^{\infty} \left\{ 1 + e^{-t} - \frac{2t}{(e^{t}-1)} \right\} e^{-st} \, \mathrm{d}t \\
&= \frac{1}{s} + \frac{1}{s+1} - 2\sum_{n=1}^{\infty} \frac{1}{(n+s)^2} \\
&= \frac{1}{s} + \frac{1}{s+1} - 2\psi'(s+1),
\end{align*}
where $\psi(\cdot)$ refers to the digamma function. Integrating both sides and utilizing the condition $F'(+\infty) = 0$ and the formula $\psi_0(s) = \log s + o(1)$ together, we get
$$ F'(s) = \log s + \log(s+1) - 2\psi_{0}(s+1). $$
Integrating both sides again, we have
$$ F(s) = s \log s + (s+1)\log(s+1) - 2s - 1 - 2\log\Gamma(s+1) + C. $$
To determine the constant $C$, we rearrange the terms as
$$ F(s) = \left\{ (s+1)\log\left(\frac{s+1}{s}\right) - 1 \right\} + 2\left\{ \left(s+\frac{1}{2}\right)\log s - s - \log\Gamma(s+1) \right\} + C. $$
Then by the Stirling's formula, we have
$$ 0 = F(+\infty) = -\log(2\pi) + C $$
and thus $C = \log (2\pi)$. Therefore
$$I
= -\frac{1}{2} + F(0) 
= \bbox[color:navy;padding:5px;border:1px dotted navy;]{\log(2\pi) - \frac{3}{2}}$$
as desired.
