An integral Lobachevsky calculated incorrectly $\int_{0}^{\infty}\frac{(e^x-e^{-x})x}{e^{2x}+e^{-2x}+2\cos(2a)}dx$ In a recent lecture a professor told a story about the integral below.  Lobachevsky calculated this integral at first time incorrectly. Following the publication of the integral,  Ostrogradsky sent a letter with correct answer to Lobachevsky.
What is the right answer?
$$I(a)=\int_{0}^{\infty}\frac{(e^x-e^{-x})x}{e^{2x}+e^{-2x}+2\cos(2a)}dx$$
withe $0\leq a \leq \pi$.

We can restrict the values of $a$ to be between $0$ and $\pi/2$ as $\cos(2a)= \cos[2(\pi-a)]$. With this $$I(a) = \frac{\pi a}{4 \sin(a)} \qquad 0\leq a \leq \frac{\pi}{2}.$$
The calculation can be done along the following line:


*

*As the integrand is symmetric the integration region can be extended to the full real line
$$I(a) = \frac{1}{2} \int_{-\infty}^{\infty}dx\, \frac{(e^x-e^{-x})x}{e^{2x}+e^{-2x}+2\cos(2a)}.$$

*The substitution $z= e^{x}$ brings the integral onto the form
$$I(a) = \frac{1}{2} \int_0^\infty dz\,\frac{(z^2-1) \log z}{z^4 + 2 z^2 \cos(2a) + 1}.$$

*A standard trick can be employed to bring it on the form
$$I(a) = \frac{1}{4} \sum_{z_n} \,\text{Res}_{z=z_n} \frac{(z^2-1) \log^2 z}{z^4 + 2 z^2 \cos(2a) + 1}$$ where $z_n$ are the zeros of $z^4 + 2 z^2 \cos(2a) + 1$ and the branch cut of $\log$ is along the negative real line.

*The 4 zeros of $z^4 + 2 z^2 \cos(2a) + 1$ are given by $\bar z=\pm i e^{\pm i a}$. The residues assume the form $$\text{Res}_{z=\bar z} \frac{(z^2-1) \log^2 z}{z^4 + 2 z^2 \cos(2a) + 1} = \frac{(\bar z^2 - 1)\log^2 \bar z}{4 \bar z^3 +4 \bar z \cos 2a}.$$

*Putting everything together, we obtain
the result quoted above (after some tedious but straightforward calculation).
