A tough definite integral using contour integration

As suggested, a contour integration technique can be used to evaluate this integral. Notice first that the integrand is an even function of $x$, then \begin{align} I&=- \frac{1}{2\pi}\int_0^\infty \log\left(\frac{(x-s_1)^2+s^2_2}{(x+s_1)^2+s^2_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx\\ &=- \frac{1}{4\pi}\int_{-\infty}^\infty \log\left(\frac{(x-s_1)^2+s^2_2}{(x+s_1)^2+s^2_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx \end{align}

Considering the integral \begin{equation} J=- \frac{1}{2\pi}\int_{-\infty}^\infty \log\left(\frac{x-s_1+is_2}{x+s_1+is_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1}\,dx \end{equation} where the log function is defined with a branch cut between the points $−s_1−is_2$ and $s_1−is_2$ with $s_2>0$. One can show that it is purely real (see (**)). By expressing the real part (see (*)), we find $J=I$.

The function is holomorphic for $\Im x>0$ except at the poles $x_k$ of the rational fraction with $\Im (x_k)>0$. If the real axis is closed by the upper half-circle $C_R$, the integral can then be evaluated by the residue method. The $C_R$ contribution vanishes as $R\to\infty$.

Assuming $0<\varepsilon<2\pi$, the poles of interest are simple : $x_+=e^{i\varepsilon/2}$ and $x_-=-e^{-i\varepsilon/2}$. The residues are then evaluated as \begin{align} R_{\pm}&=\operatorname{Res}\left[ \log\left(\frac{x-s_1+is_2}{x+s_1+is_2}\right)\frac{4x\sin\varepsilon}{x^4-2x^2\cos\varepsilon +1},x_\pm\right]\\ &= \log\left(\frac{x_\pm-s_1+is_2}{x_\pm+s_1+is_2}\right)\frac{4x_\pm\sin\varepsilon}{\left.\frac{d}{dx}\left[x^4-2x^2\cos\varepsilon +1\right]\right|_{x=x_\pm}}\\ &=\log\left(\frac{x_\pm-s_1+is_2}{x_\pm+s_1+is_2}\right)\frac{\sin\varepsilon}{x_\pm^2-\cos\varepsilon}\\ &=\mp i\log\left(\frac{x_\pm-s_1+is_2}{x_\pm+s_1+is_2}\right) \end{align} and thus \begin{align} I&=-\frac{1}{2\pi}2i\pi \sum_{\pm} R_{\pm}\\ &=-\log\left(\frac{\cos\left(\frac{\varepsilon}{2}\right)-s_1+i(s_2+\sin\left(\frac{\varepsilon}{2}\right))}{\cos\left(\frac{\varepsilon}{2}\right)+s_1+i(s_2+\sin\left(\frac{\varepsilon}{2}\right))}\right)+\log\left(\frac{-\cos\left(\frac{\varepsilon}{2}\right)-s_1+i(s_2+\sin\left(\frac{\varepsilon}{2}\right))}{-\cos\left(\frac{\varepsilon}{2}\right)+s_1+i(s_2+\sin\left(\frac{\varepsilon}{2}\right))}\right)\\ &=-\log\left(\frac{(\cos\left(\frac{\varepsilon}{2}\right)-s_1)^2+(s_2+\sin\left(\frac{\varepsilon}{2}\right))^2}{(\cos\left(\frac{\varepsilon}{2}\right)+s_1)^2+(s_2+\sin\left(\frac{\varepsilon}{2}\right))^2}\right) \end{align} Finally, \begin{equation} I= \log\left(\frac{1+s^2_1+s^2_2+2s_2\sin(\frac{\varepsilon}{2})+2s_1\cos(\frac{\varepsilon}{2})}{1+s^2_1+s^2_2+2s_2\sin(\frac{\varepsilon}{2})-2s_1\cos(\frac{\varepsilon}{2})}\right) \end{equation} as proposed.


(*): using $\log\left( Z \right)=\frac{1}{2}\log\left|Z\right|^2+i\operatorname{Arg}(Z)$

(**): If \begin{equation} J=\int_{-\infty}^\infty \log\left(\frac{x-s_1+is_2}{x+s_1+is_2}\right)f(x)\,dx \end{equation} where $f(-x)=-f(x)$ and $s_{1,2}$ are real, then the complex conjugate \begin{align} J^*&=\int_{-\infty}^\infty \log\left(\frac{x-s_1-is_2}{x+s_1-is_2}\right)f(x)\,dx\\ &=\int_{-\infty}^\infty \log\left(\frac{-x+s_1+is_2}{-x-s_1+is_2}\right)f(x)\,dx\\ &=\int_{-\infty}^\infty \log\left(\frac{y+s_1+is_2}{y-s_1+is_2}\right)f(-y)\,dy\\ &=J \end{align} The integral is thus real.