For all real $a>0$ consider $$\int_0^\infty x^a \left (\sum_{n = 1}^\infty (-1)^n n e^{-2nx} \right ) \, dx.$$
I would like to interchange the summation with the integration in order to find its value but I am having trouble justifying such a change.
Fubini's theorem is not strong enough to justify the interchange for all $a > 0$. If we put absolute values on the terms, we have $$\left | \sum_{n = 1}^\infty (-1)^n n e^{-2nx} \right | \leqslant \sum_{n = 1}^\infty n e^{-2nx} = \frac{e^{2x}}{(e^{2x} - 1)^2}$$ but $\displaystyle\int_0^\infty \frac{x^a e^{2x}}{(e^{2x} - 1)^2}~dx$ only converges for $a > 1$ and not for all $a > 0$.
So my question is, how can the interchange between the summation and integration be justified so that it holds for all $a > 0$?
Note that:
$$\sum_{n = 1}^k (-1)^n n e^{-2nx}=\frac{-e^{2x}}{(1+e^{2x})^2}+\frac{(-1)^k}{e^{2(k-1)x}(1+e^{2x})^2}+\frac{(-1)^kk}{e^{2kx}(1+e^{2x})}$$ Since $k\ge1$ and $\displaystyle\frac k{e^{2kx}}\le\frac k{2kx}=\frac1{2x}$, hence
$$\left|\sum_{n = 1}^k (-1)^n n e^{-2nx}\right|\le\frac{e^{2x}}{(1+e^{2x})^2}+\frac{1}{(1+e^{2x})^2}+\frac{1}{2x(1+e^{2x})}$$
further,
$$\left|x^a\cdot\sum_{n = 1}^k (-1)^n n e^{-2nx}\right|\le\frac{x^ae^{2x}}{(1+e^{2x})^2}+\frac{x^a}{(1+e^{2x})^2}+\frac{x^{a-1}}{2(1+e^{2x})}$$
Apparently, the RHS is convergent for $a>0$, hence we can switch the summation and integration.