TITLE: How to solve this integral: $\int_{-\infty}^\infty\frac{x^2 e^x}{(e^x+1)^2}\:dx$
QUESTION [7 upvotes]: I am trying to solve an integral like this:
$$
I=\int \frac{x^2 e^x}{(e^x+1)^2} dx
$$
And I get this answer:
$$
\int \frac{x^2 e^x}{(e^x+1)^2}dx=x^2-\frac{x^2}{e^x+1}-2x\text{ln}(e^x+1)+2\int\text{ln}(e^x+1)dx
$$
Where ln denotes natural logarithm.
The last integral can be rewritten as Li$_2(-e^x)$:
\begin{gather}
\int\text{ln}(e^x+1)dx=\begin{cases} u=e^x\\
du=e^xdx\Rightarrow dx={du\over u}\end{cases}\Rightarrow\\
\Rightarrow \int\text{ln}(e^x+1)dx=\int\frac{\text{ln}(u+1)}{u} du
\end{gather}
As Li$_1(z)=-\text{ln}(1-z)\Rightarrow \text{ln}(u+1)=\text{ln}(1-(-u))=-\text{Li}_1(-u)$, it yields:
\begin{gather}
\int\frac{\text{ln}(u+1)}{u} du=-\int\frac{\text{Li}_1(-u)}{u}du=-\text{Li}_2(-u)=-\text{Li}_2(-e^x)
\end{gather}
Finally:
\begin{gather}
\int \frac{x^2 e^x}{(e^x+1)^2} dx=\int \frac{x^2 e^x}{(e^x+1)^2}dx=x^2-\frac{x^2}{e^x+1}-2x\text{ln}(e^x+1)-2\text{Li}_2(-e^x)
\end{gather}
Now, I need to evaluate $I$ from $-\infty$ to $\infty$. I have solved it in Wolfram Alpha, but although it often shows the step by step option, in this case, it doesn't. The result is $\pi^2/3$, which is barely $\zeta(2)$, where $\zeta(\cdot)$ is the Riemann's zeta function, closely related to polylogarithms. So the question is how to evaluate this integral from $-\infty$ to $\infty$. Thank you in advance.

REPLY [4 votes]: Because $\frac{x^2e^x}{(e^x+1)^2}=\frac{x^2}{\left(e^{x/2}+e^{-x/2}\right)^2}$ is even, we can integrate by parts and use the Dirichlet eta function:
$$
\begin{align}
\int_{-\infty}^\infty\frac{x^2e^x}{(e^x+1)^2}\,\mathrm{d}x
&=2\int_0^\infty\frac{x^2e^x}{(e^x+1)^2}\,\mathrm{d}x\\
&=-2\int_0^\infty x^2\,\mathrm{d}\frac1{e^x+1}\\
&=4\int_0^\infty\frac{x}{e^x+1}\,\mathrm{d}x\\
&=4\Gamma(2)\,\eta(2)\\[6pt]
&=2\zeta(2)\\
&=\frac{\pi^2}3
\end{align}
$$