Existence of expected values of positive random variables

Without further assumptions on the monotonicity of the derivative the claim is in general not correct.

Example Let

$$h(x) := \begin{cases} 2 \left(n^2-\frac{1}{n^2} \right) \cdot (x-n)+\frac{1}{n^2} & x \in \left[n,n+\frac{1}{2} \right] \\ n^2- 2 \left(n^2-\frac{1}{(n+1)^2} \right) \left(x-n-\frac{1}{2} \right) & x \in \left[n+ \frac{1}{2},n+1 \right] \end{cases}$$

for $n \in \mathbb{N}$.

$\hspace{90pt}$enter image description here

Then $h$ is a (strictly) positive continous function and therefore

$$g(x) := \int_0^x h(y) \, dy$$

defines a strictly increasing differentiable positive function. In particular, $g'(n)= \frac{1}{n^2}$ and $$g' (x) \geq \frac{n^2}{2}, \qquad x \in \left[n+\frac{1}{4},n+\frac{3}{4} \right]. \tag{1}$$

Now if we consider a random variable $X$ such that $\mathbb{P}(X > x) = \frac{1}{x}$ for $x$ sufficiently large, then $(1)$ shows that

$$\int_{(0,\infty)} g'(x) \mathbb{P}(X>x) \, dx = \infty.$$

On the other hand,

$$\sum_{n} g'(n) \mathbb{P}(X >n) \leq \sum_n g'(n) = \sum_n \frac{1}{n^2} < \infty.$$