After working for some time, I came up with the following solution. I hope it is correct.

Let \(\displaystyle f(z)=\frac{z(1-z^2)}{(z^2+a^2)^2} \log \left(\frac{1+z}{1-z} \right)\) and consider the contour integral

\[\oint_{C} \frac{z(1-z^2)}{(z^2+a^2)^2} \log \left(\frac{1+z}{1-z}\right) \; dz\]

where \(C\) is the following contour

1. \( \gamma \) is a large semicircle of

radius \(R\) centered at the origin.

2. \(\alpha\) and \(\beta\) are quarter circle indents around the branch points \(-1,1\) respectively of

radius \(\epsilon \).

3. There are 3 line segments joining

- \(-\sqrt{R^2-\epsilon^2}+i \epsilon\) and \(-1+i \epsilon\)
- \(-1+\epsilon \) and \(1-\epsilon \)
- \(1+i \epsilon\) and \(\sqrt{R^2-\epsilon^2}+i \epsilon\)

For the line segments above the branch cuts, we have

\(\displaystyle \int_{-\sqrt{R^2-\epsilon^2}+i\epsilon}^{-1+i\epsilon} f(z) \; dz +\int_{1+i\epsilon}^{\sqrt{R^2-\epsilon^2}+i\epsilon} f(z)\; dz\)

\(\displaystyle \begin{align*}

\; &= \int_{-\sqrt{R^2-\epsilon^2}+i\epsilon}^{-1+i\epsilon} \frac{z(1-z^2)}{(z^2+a^2)^2}\left\{ \log \Bigg( \frac{|1+z|}{1-z} \Bigg)+i\pi \right\}dz + \int_{1+i\epsilon}^{\sqrt{R^2-\epsilon^2}+i\epsilon} \frac{z(1-z^2)}{(z^2+a^2)^2}\left\{ \log \Bigg( \frac{1+z}{|1-z|} \Bigg) -i\pi \right\}dz \\

&\;

\\

&\to 2 \int_1^\infty \frac{x(1-x^2)}{(x^2+a^2)^2}\log \left( \frac{x+1}{x-1} \right) dx \\ &\quad \text{as } R\to \infty \text{ and }\epsilon\to 0^+

\end{align*}\)

Similarly for the other segment,

\(\displaystyle \int_{-1+\epsilon}^{1+\epsilon}f(z) \; dz \to 2 \int_0^1 \frac{x(1-x^2)}{(x^2+a^2)^2}\log \left( \frac{1+x}{1-x} \right)dx \quad \text{as }\epsilon \to 0^+\)

And also,

\(\displaystyle \int_\gamma f(z)\; dz \to \pi^2 \text{ as }R\to \infty\)

\(\displaystyle \int_\alpha f(z)\; dz \to 0 \quad , \int_\beta f(z)\; dz \to 0 \text{ as }\epsilon \to 0^+\)

So by the residue theorem, we get

\(\displaystyle \begin{align*}

\lim_{\begin{matrix}R\to \infty \\ \epsilon \to 0^+\end{matrix}}\oint_{C} f(z)\; dz &=2\pi i \text{Res}_{z=i a} \frac{z(1-z^2)}{(z^2+a^2)^2} \log \left(\frac{1+z}{1-z}\right) \\

&\;

\\ \implies 2\int_0^1 \frac{x(1-x^2)}{(x^2+a^2)^2}\log \left( \frac{1+x}{1-x} \right) dx+2 \int_1^\infty \frac{x(1-x^2)}{(x^2+a^2)^2}\log \left( \frac{x+1}{x-1} \right) dx +\pi^2 &= 2\pi i \left( -\frac{i}{2a}-\frac{1}{2} \log \left( \frac{i-a}{i+a}\right)\right) \\

&\; \\

\implies 2 \int_0^\infty \frac{x(1-x^2)}{(x^2+a^2)^2}\log \Bigg| \frac{1+x}{1-x} \Bigg| dx +\pi^2 &= \frac{\pi}{a}-2\pi \tan^{-1}\frac{1}{a}+\pi^2 \\

&\; \\

\implies \int_0^\infty \frac{x(1-x^2)}{(x^2+a^2)^2}\log \Bigg| \frac{1+x}{1-x} \Bigg| dx &= \boxed{\displaystyle \pi \left(\frac{1}{2a}- \tan^{-1}\frac{1}{a}\right)}

\end{align*}\)

EDITI just noticed that this problem is much easier if we choose \(\displaystyle f(z)=\frac{z(1-z^2)}{(z^2+a^2)^2} \log \left(\frac{1+z}{\color{red}{z-1}} \right)\) instead of \(\displaystyle f(z)=\frac{z(1-z^2)}{(z^2+a^2)^2} \log \left(\frac{1+z}{1-z} \right)\).