If we know the PDF $f$ of a random variable $X$ then we can compute an expression like $\mathrm E[g(X)]$ as $$\mathrm E[g(X)] = \int_{\mathrm{Im}(X)} g(x) f(x) \mathrm dx \, .$$
Let $F$ be the CDF of a positive random variable $X$, then we call $\bar{F}=1-F$ the complementary CDF (CCDF) of $X$. It is a well-known result that $\mathrm E[X] = \int_{\mathrm{Im}(X)} \bar{F}(x) \mathrm dx$. Is there a handy formular that allows to apply that to terms like $\mathrm E[g(X)]$? Since we have $\mathrm E[g(X)] = \int_{\mathrm{Im}(X)} g(x) \mathrm d F(x)$, another way to phrase the question is whether there is a general way to relate the Lebesgue-Stieltjes integral with respect to the CDF of $X$ to an integral involving its CCDF?
These questions came up while I was trying to solve a problem and I could reduce it to asserting that for some positive constant $r$ we have \begin{align}r \int_0^\infty x \mathrm{e}^{rx}\bar{F}(x)\mathrm{d}x &= \frac{\mathrm{d}}{\mathrm{d}r} \mathrm{E}[\mathrm{e}^{rX}] - \int_0^\infty \mathrm{e}^{rx}\bar{F}(x)\mathrm{d}x \\ &= \int_0^\infty x \mathrm{e}^{rx} \mathrm{d}F(x) - \int_0^\infty \mathrm{e}^{rx}\bar{F}(x)\mathrm{d}x \, . \end{align}
And I don't see a way to relate the two sides of this equation. I hope that I didn't miss any piece of additional information which makes this true, not holding in general though.