# How to show $\int_{0}^{\infty}\frac{x}{x^{2}+1}\log\left(\left|\frac{x^r+1}{x^r-1}\right|\right)dx = \frac{\pi^2}{4r}$?

After playing around with a few values of $$r$$, I have the following conjecture: $$\int_{0}^{\infty}\frac{x}{x^{2}+1}\log\left(\left|\frac{x^r+1}{x^r-1}\right|\right)dx = \frac{\pi^2}{4r}$$ for $$r\gt 0$$. My question is whether or not this is true and how to show as such.

I was inspired to ask this question after reading Cody's about showing $$\displaystyle \int_{0}^{\infty}\frac{x}{x^{2}+a^{2}}\log\left(\left|\frac{x+1}{x-1}\right|\right)dx=\pi\tan^{-1}(1/a)$$ One can see that the $$r=1$$ case of mine and the $$a=1$$ case of Cody's coincide.

That integral with $$r=1$$ lends itself to contour integration in the upper half plane because $$\log\left(\left|\frac{x+1}{x-1}\right|\right)$$ is an odd function, making the integrand even. However, my integrand lacks that nice symmetry for arbitrary $$r$$. For odd integers $$r$$, we regain that symmetry but branch points in the upper half plane add complexity. I'm not sure whether the integral with irrational $$r$$ can be handled with complex techniques, so I feel unsure of how to proceed.

By replacing $x$ with $z^{1/r}$ we get
$$I(r) = \frac{1}{r}\int_{0}^{+\infty}\frac{z^{2/r}}{z^{2/r}+1}\log\left|\frac{z+1}{z-1}\right|\frac{dz}{z}$$ then by splitting $\mathbb{R}^+$ as $(0,1]\cup(1,+\infty)$ and performing $z\mapsto\frac{1}{z}$ on the second "half" we get
$$I(r) = \frac{1}{r}\int_{0}^{1}\frac{z^{2/r}+1}{z^{2/r}+1}\log\left(\frac{1+z}{1-z}\right)\frac{dz}{z}=\frac{1}{r}\int_{0}^{1}\frac{\log(1+z)-\log(1-z)}{z}\,dz.$$ Now it is enough to invoke the Maclaurin series of $\log(1\pm z)$ and $\sum_{n\geq 1}\frac{1}{n^2}=\frac{\pi^2}{6}$, $\sum_{n\geq 1}\frac{(-1)^{n+1}}{n^2}=\frac{\pi^2}{12}$ to prove the claim.
I'll offer another approach. You can easily show $f(x):=\tfrac{x}{x^2+1}\ln|\tfrac{x^r+1}{x^r-1}|$ satisfies $f(\tfrac{1}{x})=f(x)$ so $$\int_0^\infty f(x)dx=\int_0^1 (1+\tfrac{1}{x^2})f(x)dx=\int_0^1 \tfrac{1}{x}\ln\tfrac{1+x^r}{1-x^r}dx.$$With $y=x^r$ your integral becomes $\tfrac{1}{r}\int_0^1 \tfrac{1}{y}\ln\tfrac{1+y}{1-y}dy$, so the $r=1$ case you already know completes the proof.