How to evaluate this integral $\int_{-\infty}^{+\infty}\frac{x^2e^x}{(1+e^x)^2}dx$?

$$f(x) = \dfrac{x^2 \exp(x)}{(1+\exp(x))^2} = \dfrac{x^2 \exp(-x)}{\left(1 + \exp(-x) \right)^2}$$ Recall that $$\dfrac{a}{(1+a)^2} = a -2a^2 + 3a^3 - 4a^4 + 5a^5 \mp \cdots = \sum_{k=1}^{\infty}(-1)^{k+1}k a^k$$ For $x > 0$, $$f(x) = x^2 \sum_{k=1}^{\infty} (-1)^{k+1} k \exp(-kx)$$

Now for $a > 0$, $$\int_0^{\infty} x^2 \exp(-ax) = \dfrac2{a^3}$$ Hence, $$\int_0^{\infty} f(x) dx = \sum_{k=1}^{\infty} (-1)^{k+1} \dfrac{2k}{k^3} = 2 \sum_{k=1}^{\infty} \dfrac{(-1)^{k+1}}{k^2} = \dfrac{\pi^2}6$$

Hence, $$\int_{-\infty}^{\infty} f(x) dx = 2 \int_0^{\infty} f(x) dx = \dfrac{\pi^2}3$$


In a more general setting, let $$F\left( s \right) = \int\limits_0^\infty {\frac{{{x^{s - 1}}}}{{{{\left( {{e^x} + 1} \right)}^2}}}{e^x}dx} $$

We have, whenever $|e^{-x}|<1$, that is, for $x>0$, that

$$\frac{1}{{1 + {e^{ - x}}}} = \sum\limits_{k = 0}^\infty {{{\left( { - 1} \right)}^k}{e^{ - kx}}} $$

and convergence is uniform. Thus

$$\frac{{{e^{ - x}}}}{{{{\left( {1 + {e^{ - x}}} \right)}^2}}} = \frac{d}{{dx}}\frac{1}{{1 + {e^{ - x}}}} = \sum\limits_{k = 0}^\infty {{{\left( { - 1} \right)}^k}\frac{d}{{dx}}{e^{ - kx}}} = \sum\limits_{k = 1}^\infty {{{\left( { - 1} \right)}^{k + 1}}k{e^{ - kx}}} $$

Note that after multipication and division by $e^{2x}$ one gets $$\frac{{{e^x}}}{{{{\left( {1 + {e^x}} \right)}^2}}} = \sum\limits_{k = 1}^\infty {{{\left( { - 1} \right)}^{k + 1}}k{e^{ - kx}}} $$

Thus $$\frac{{{e^x}{x^{s - 1}}}}{{{{\left( {1 + {e^x}} \right)}^2}}} = \sum\limits_{k = 1}^\infty {{{\left( { - 1} \right)}^{k + 1}}k{e^{ - kx}}{x^{s - 1}}} $$

Now, we look at individual terms $$\int\limits_0^\infty {{e^{ - kx}}{x^{s - 1}}dx} = \frac{1}{{{k^s}}}\int\limits_0^\infty {{e^{ - kx}}{{\left( {kx} \right)}^{s - 1}}d\left( {kx} \right)} = \frac{1}{{{k^s}}}\int\limits_0^\infty {{e^{ - u}}{u^{s - 1}}du} = \frac{1}{{{k^s}}}\Gamma \left( s \right)$$

Thus$$\tag 1 \int\limits_0^\infty {\frac{{{e^x}{x^{s - 1}}}}{{{{\left( {1 + {e^x}} \right)}^2}}}} = \Gamma \left( s \right)\sum\limits_{k = 1}^\infty {{{\left( { - 1} \right)}^{k - 1}}\frac{1}{{{k^{s-1}}}}} = \Gamma \left( s \right)\eta \left( s-1 \right)$$

Specializing for $s=3$, we get:

$$\int\limits_0^\infty {\frac{{{e^x}{x^2}}}{{{{\left( {1 + {e^x}} \right)}^2}}}} = \Gamma \left( 3 \right)\eta \left( 2 \right) = 2!\frac{{{\pi ^2}}}{{12}} = \frac{{{\pi ^2}}}{6}$$

so that$$\int\limits_{ - \infty }^\infty {\frac{{{e^x}{x^2}}}{{{{\left( {1 + {e^x}} \right)}^2}}}} = 2\frac{{{\pi ^2}}}{6} = \frac{{{\pi ^2}}}{3}$$

You might be interested in this question of mine where I wonder about integrals of the form $$\int\limits_0^\infty {F\left( {\frac{1}{{{e^x} - 1}},{e^x},{x^s}} \right)dx} $$ and provide some similar expressions to $(1)$.