An integral with logarithm and rational function Can someone solve:
$ \int_0^\infty dx \frac{\log (x)}{(x-1)(x+a)}\;,$
for $a$ say a positive real (or presumably any non real-negative complex number). Note there is no pole at $x=1$.
I can easily find the solution on mathematica, but I can't find a `proof'. My instinct is to use some nice contour, or bring the integral limits to [0,1] and expand the log, but I can't make either work!
Edit: Sorry I should have added the following. I know that the above integral is easily evaluated via partial fractions and using properties of dilogarithms, but I am wondering out of curiosity whether a simpler proof is possible. Certainly the result (see below) looks as if there should be an extremely elementary argument.
 A: Using partial fraction decomposition,
$$\frac{\log (x)}{(x-1)(x+a)}=\frac 1 {1+a}\left(\frac{\log(x)}{x-1}-\frac{\log(x)}{x+a}\right)$$ Assuming $a > 0$
$$\int \frac{\log (x)}{(x-1)(x+a)}\,dx=\frac {-1} {1+a}\left(\text{Li}_2(1-x)+\text{Li}_2\left(-\frac{x}{a}\right)+\log (x) \log \left(1+\frac{x}{a}\right)\right)$$
Integrate between $0$ and $p$ and use the asymptotics to get
$$\int_0^p \frac{\log (x)}{(x-1)(x+a)}\,dx=\frac{\log ^2\left({a}\right)+\pi ^2}{2 (a+1)}-\frac{\log
   \left({p}\right)+1}{p}+O\left(\frac{1}{p^2}\right)$$
 Now, using the asymptotics
A: (tldr: See $J$ below and do a keyhole contour)
The integral is almost trivial, but for a mild subtlety regarding principal values. For instance, if we were to choose a non-standard branch of the log, the integral would need to be regulated (eg a principal value (PV) is needed).
We should consider
$$J := \int_C dz \frac{(\log z)^2}{(z-1)(z-z_0)}$$
where $z_0$ is any non-real-positive complex number and $C$ is a keyhole contour, modified to avoid the point $z=1$ by introducing two more arcs. The arc around the origin and the large arc are easily seen to vanish. The arcs around $z=1$ are parametrized by $z = 1+\epsilon e^{i\theta}$ where $\theta \in (\pi,0)$ and $z = e^{2\pi i}(1+\epsilon e^{-i\theta})$ where $\theta \in (0,\pi)$. They contribute
$$ J_1 := \int_\pi^0 i\epsilon d\theta e^{i\theta} \frac{(\log(1+\epsilon e^{i\theta}))^2}{\epsilon e^{i\theta}(1-z_0+\epsilon e^{i\theta})} \rightarrow  0\;,$$
$$ J_2 := \int_0^\pi (-i\epsilon) d\theta e^{-i\theta} \frac{(2\pi i+\log(1+\epsilon e^{-i\theta}))^2}{\epsilon e^{-i\theta}(1-z_0+\epsilon e^{-i\theta})} \rightarrow \frac{4\pi^2i}{1-z_0} \int^\pi_0 d\theta = \frac{4\pi^3i}{1-z_0}\;.$$
Over the whole contour, we pick up a single residue at $z=z_0$. Thus
$$ P.V.\int_0^\infty dx \frac{(\log x)^2}{(x-z_0)(x-1)} +J_1 - P.V.\int_0^\infty dx \frac{(2\pi i +\log x)^2}{(x-z_0)(x-1)} + J_2 = 2\pi i \frac{(\log z_0)^2}{z_0-1}\;. $$
For our purposes $z_0 = -a$ is real and negative. Taking the imaginary part and dividing by $-4\pi$ gives
$$ P.V.\int_0^\infty dx \frac{\log x}{(x+a)(x-1)} -\frac{\pi^2}{1+a}= \frac{\Re(\log (-a))^2}{2(a+1)}  = \frac{(\log a )^2 - \pi^2}{2(a+1)} \;. $$
We can drop the P.V. on the left if we choose the principal branch of the log, which gives the required integral:
$$\int_0^\infty dx \frac{\log x}{(x+a)(x-1)} = \frac{(\log a )^2 + \pi^2}{2(a+1)} \;.$$
Incidentally, together with this nice integral
$$I := \int_0^\infty dx \frac{\log x}{(x+\alpha)^2 + \beta^2} = \frac{1}{2\beta}\log(\alpha^2 + \beta^2) \tan^{-1}(\beta/\alpha)\;, $$
where $\beta>0$,  and also the obvious integrals which can be done via partial fractions we completely classify integrals of the form
$$ \int_0^\infty dx \frac{\log x}{ax^2 + bx + c}\;,$$ where $a,b,c$ are real coefficients such that the integral is well defined.
The integral $I$ is easily evaluated - let $z_0 := \alpha+i\beta$ (note that $I=\frac{i\Im((\log z_0)^2)}{z_0-\bar{z}_0}$) and consider $$ J = \int_C dz \frac{(\log z)^2}{(z-z_0)(z-\bar{z}_0)}\;, $$ on a semicircular contour on the upper half plane.
A: Let $a>0$,
\begin{align}
J=\int_0^\infty \frac{\ln x}{(x-1)(x+a)} \,dx
\end{align}
Perform the change of variable $y=\dfrac{x-1}{x+a}$,
\begin{align}
J&=\frac{1}{1+a} \int_{-\frac{1}{a}}^1 \frac{\ln\left( \frac{1+ax}{1-x} \right)}{x}dx\\
&=\frac{1}{1+a}\int_{-\frac{1}{a}}^1 \frac{\ln\left( 1+ax\right)}{x}\,dx-\frac{1}{1+a}\int_{-\frac{1}{a}}^1 \frac{\ln\left( 1-x\right)}{x}dx
\end{align}
In the first integral perform the change of variable $y=-ax$,
\begin{align}
J&=-\frac{1}{1+a}\int_{-a}^1 \frac{\ln\left( 1-x\right)}{x}dx-\frac{1}{1+a}\int_{-\frac{1}{a}}^1 \frac{\ln\left( 1-x\right)}{x}dx\\
&=-\frac{2}{1+a}\int_0^1 \frac{\ln(1-x)}{x}dx-\frac{1}{1+a}\int_{-a}^0 \frac{\ln\left( 1-x\right)}{x}dx-\frac{1}{1+a}\int_{-\frac{1}{a}}^0 \frac{\ln\left( 1-x\right)}{x}dx
\end{align}
In the last two integrals perform the change of variable $y=-x$,
\begin{align}J&=-\frac{2}{1+a}\int_0^1 \frac{\ln(1-x)}{x}dx+\frac{1}{1+a}\int_{0}^a \frac{\ln\left( 1+x\right)}{x}dx+\frac{1}{1+a}\int_0^{\frac{1}{a}} \frac{\ln\left( 1+x\right)}{x}dx\\
&=\frac{2}{1+a}\int_0^1 \frac{\ln\left(\frac{1+x}{1-x}\right)}{x}dx+\frac{1}{1+a}\int_{1}^a \frac{\ln\left( 1+x\right)}{x}dx+\frac{1}{1+a}\int_1^{\frac{1}{a}} \frac{\ln\left( 1+x\right)}{x}dx
\end{align}
In the latter integral perform the change of variable $y=\dfrac{1}{x}$,
\begin{align}J&=\frac{2}{1+a}\int_0^1 \frac{\ln\left(\frac{1+x}{1-x}\right)}{x}dx+\frac{1}{1+a}\int_{1}^a \frac{\ln\left( 1+x\right)}{x}dx-\frac{1}{1+a}\int_1^{a} \frac{\ln\left( \frac{1+x}{x}\right)}{x}dx\\
&=\frac{2}{1+a}\int_0^1 \frac{\ln\left(\frac{1+x}{1-x}\right)}{x}dx+\frac{1}{1+a}\int_{1}^a \frac{\ln x}{x}dx\\
&=\frac{2}{1+a}\int_0^1 \frac{\ln\left(\frac{1+x}{1-x}\right)}{x}dx+\frac{\ln^2 a}{2(1+a)}
\end{align}
In the first integral perform the change of variable $y=\dfrac{1-x}{1+x}$,
\begin{align}
J&=-\frac{4}{1+a}\int_0^1 \frac{\ln x}{1-x^2}dx+\frac{\ln^2 a}{2(1+a)}\\
&=\frac{4}{1+a}\int_0^1 \frac{x\ln x}{1-x^2}dx-\frac{4}{1+a}\int_0^1 \frac{\ln x}{1-x}dx+\frac{\ln^2 a}{2(1+a)}
\end{align}
In the first integral perform the change of variable $y=x^2$,
\begin{align}J&=\frac{4}{1+a}\left( \frac{1}{4}-1\right) \int_0^1 \frac{\ln x}{1-x}dx+\frac{\ln^2 a}{2(1+a)}\\
&=\frac{\ln^2 a}{2(1+a)}-\frac{3}{1+a}\int_0^1 \frac{\ln x}{1-x}dx\\
&=\boxed{\frac{\ln^2 a}{2(1+a)}+\frac{\pi^2}{2(1+a)}}
\end{align}
NB: I assume,
\begin{align}\int_0^1 \frac{\ln x}{1-x}dx=-\frac{\pi^2}{6}\end{align}
