TITLE: How can we show that $\int_{-\infty}^{+\infty}{ke^x\pm1\over \pi^2+(e^x-x+1)^2}\cdot{(e^x+1)^2\over \pi^2+(e^x+x+1)^2}\cdot 2x \,\mathrm dx=k?$
QUESTION [18 upvotes]: Motivated by this paper.
Conjecture:

$$\int_{-\infty}^{+\infty}{ke^x\pm1\over \pi^2+(e^x-x+1)^2}\cdot{(e^x+1)^2\over \pi^2+(e^x+x+1)^2}\cdot 2x \,\mathrm dx=k,\tag1$$
  where $k$ is a real number.

Making an attempt:
$u=e^x+1\implies \,\mathrm du=e^x\,\mathrm dx$ and let $k=1$ for simplification, then (1) becomes
$$\int_{1}^{\infty}{u^3\over \pi^2+(u-x)^2}\cdot{\ln(u-1)\over \pi^2+(u+x)^2}\cdot{2\mathrm du\over u-1}.\tag2$$
I have no idea where to go from here! I don't think substitution work here, probably using contour integration.
How can we prove (1)?

REPLY [12 votes]: Some integrals

Let us prove that 

$$\boxed{I_0 = \int\limits_{-\infty}^{+\infty}{dz\over\left(e^z-z+1\right)^2+\pi^2} = {1\over2}}$$
Roots of the denominator can be defined from the system
$$\begin{cases}
z=x+iy\\
\left(e^x\cos y - x + 1 + ie^x\sin y - iy\right)^2 + \pi^2 = 0,
\end{cases}$$
$$\begin{cases}
z=x+iy\\
\left(e^x\cos y - x + 1\right)^2 - \left(e^x\sin y - y\right)^2 + \pi^2 = 0\\
\left(e^x\cos y - x + 1\right)\left(e^x\sin y - y\right) = 0,
\end{cases}$$
$$\begin{cases}
z=x+iy\\
e^x\cos y = x - 1\\
\left|e^x\sin y - y\right| = \pi,
\end{cases}$$
with the solutions $z=\pm\pi i$ (see also Wolfram Alpha).
So, 
$$I_0 = 2\pi i\,\mathrm{Res}_{z=\pi i}{1\over\left(e^z-z+1\right)^2+\pi^2} = 2\pi i\lim_{z\to\pi i}{1\over2\left(e^z-z+1\right)\left(e^z-1\right)} = {1\over2}.$$

Let us prove that

$$\boxed{I_1 = \int\limits_{-\infty}^{+\infty}{dz\over\left(e^z+z+1\right)^2+\pi^2} = {2\over3}}$$
Roots of the denominator can be defined from the system
$$\begin{cases}
z=x+iy\\
\left(e^x\cos y + x + 1 + ie^x\sin y + iy\right)^2 + \pi^2 = 0,
\end{cases}$$
$$\begin{cases}
z=x+iy\\
\left(e^x\cos y + x + 1\right)^2 - \left(e^x\sin y + y\right)^2 + \pi^2 = 0\\
\left(e^x\cos y + x + 1\right)\left(e^x\sin y + y\right) = 0,
\end{cases}$$
$$\begin{cases}
z=x+iy\\
e^x\cos y + x + 1 = 0\\
\left|e^x\sin y + y\right| = \pi,
\end{cases}$$
with the solutions $z=\pm\pi i$ (see also Wolfram Alpha).
Note that the point $z=\pi i$ is a second-order pole, so
$$I_1 = 2\pi i\,\mathrm{Res}_{z=\pi i}{1\over\left(e^z+z+1\right)^2+\pi^2} = 2\pi i\lim_{z\to\pi i} {d\over dz}\left({(z-\pi i)^2\over\left(e^z+z+1\right)^2+\pi^2}\right) = {2\over3}.$$
(see also Wolfram Alpha).

Let us prove that 

$$\boxed{I_2 = \int\limits_{-\infty}^{+\infty}{e^zdz\over\left(e^z-z+1\right)^2+\pi^2} = {1\over2}}$$
Really, 
$$I_2 = \int\limits_{-\infty}^{+\infty}{e^zdz\over\left(e^z-z+1\right)^2+\pi^2}= \int\limits_{-\infty}^{+\infty}{e^z-1\over\left(e^z-z+1\right)^2+\pi^2}\,dz + I_0$$
$$ = {1\over\pi}\left.\arctan{e^z-z-1\over\pi}\right|_{-\infty}^{+\infty} + {1\over 2} = {1\over2}.$$

Let us prove that 

$$\boxed{I_3 = \int\limits_{-\infty}^{+\infty}{e^zdz\over\left(e^z+z+1\right)^2+\pi^2} = {1\over3}}$$
Similarly, 
$$I_3 = \int\limits_{-\infty}^{+\infty}{e^zdz\over\left(e^z+z+1\right)^2+\pi^2}= \int\limits_{-\infty}^{+\infty}{e^z+1\over\left(e^z+z+1\right)^2+\pi^2}\,dz - I_1$$
$$ = {1\over\pi}\left.\arctan{e^z+z-1\over\pi}\right|_{-\infty}^{+\infty} - {2\over 3} = {1\over3}.$$

Let us prove that 

$$\boxed{I_4 = \int\limits_{-\infty}^{+\infty}{2z(e^z+1)^2\over\left(\left(e^z-z+1\right)^2+\pi^2\right)\left(\left(e^z+z+1\right)^2+\pi^2\right)}\,dx = 0}$$
Really,
$$I_4 = \int\limits_{-\infty}^{+\infty}{2z(e^z+1)^2\over\left(\left(e^z-z+1\right)^2+\pi^2\right)\left(\left(e^z+z+1\right)^2+\pi^2\right)}\,dx$$
$$= \int\limits_{-\infty}^{+\infty}{e^z+1\over2}\left({1\over\left(e^z-z+1\right)^2+\pi^2} - {1\over\left(e^z+z+1\right)^2+\pi^2}\right)\,dx$$
$$= {I_2+I_0-I_3-I_1\over2} = {1\over2}\left({1\over2}+{1\over2}-{2\over3}-{1\over3}\right) = 0.$$

Let us prove that 

$$\boxed{I_5 = \int\limits_{-\infty}^{+\infty}{2ze^z(e^z+1)^2\over\left(\left(e^z-z+1\right)^2+\pi^2\right)\left(\left(e^z+z+1\right)^2+\pi^2\right)}\,dx =
 1}$$
The denominator is
$$D(z) = \left(\left(e^z+1\right)^2+z^2
+\pi^2 - 2z\left(e^z+1\right)\right) \left(\left(e^z+1\right)^2+z^2+\pi^2 + 2z\left(e^z+1\right)\right)$$
$$= \left(\left(e^z+1\right)^2+z^2+\pi^2\right)^2 - 4z^2\left(e^z+1\right)^2,$$
$$D'(z) = 4\left(e^z+z+1\right)\left(\left(e^z+1\right)^2+z^2+\pi^2\right) -8z\left(e^z+1\right)\left(e^z+z+1\right)$$
$$=4\left(e^z+z+1\right)\left(\left(e^z-z+1\right)^2+\pi^2\right)$$
The point $z=\pi i\ $ is the simple pole. So,
$$I_5 = 2\pi i\,\mathrm{Res}_{z=\pi i}{2ze^z(e^z+1)^2\over\left(\left(e^z-z+1\right)^2+\pi^2\right)\left(\left(e^z+z+1\right)^2+\pi^2\right)}$$
$$ = 2\pi i\,\lim_{z\to\pi i}{2ze^z(e^z+1)^2\over D'(z)} = 1.$$
(see also Wolfram Alpha)
Final calculations
$$I = \int\limits_{-\infty}^{+\infty}{ke^x\pm1\over \pi^2+(e^x-x+1)}\cdot{(e^x+1)^2\over \pi^2+(e^x+x+1)^2}\cdot 2x \mathrm dx$$
$$= kI_5\pm I_4 = k.$$
Finally,
$$\boxed{\boxed{I = k}}$$