My probability notes say the following:
For any function $h(\cdot)$, $h(X)$ is a random variable (at least if we forget about measurability issues). To calculate the expectation $Eh(X)$, one can derive the distribution of $h(X)$, say, $Y = h(X)$, and compute $E[Y]$ or use the following direct calculation: $$E[h(X)] = \begin{cases} \sum_{x_i} h(x_i) p_i & \text{if $X$ is discrete} \\ \int h(x) f(x) \ dx & \text{if $X$ is continuous} \end{cases}$$
I have not studied any measure theory, but I'm curious about this statement about measurability issues. Would someone please explain what the "issue" is here, in more-understandable probability theory language (rather than measure theory language)? So is it still valid to consider $h(X)$ as a random variable? It seems like it is saying "this is incorrect, but proceed as if it were correct anyway"; it isn't clear to me how this results in sensible mathematics, which, clearly, it does, since, in probability theory, we often just assume that $h(X)$ can be considered as a random variable, as done in the excerpt.