For $X$, a positive random variable, use Fubini's theorem applied to $\sigma$-finite measure to prove
\begin{align*} E(X)= \int_{[0, \infty)} P[X>t] dt \end{align*}
I found several references on the the site like this:
but all of them assume that $X$ has density or discrete is the are different proof that does not use this assumption.
This is what I tried
\begin{align*} \int_{[0, \infty)} P[X>t] dt&= \int_{[0, \infty)} E(\mathsf{1}_{[X>t]}) dt=\int_{[0, \infty)} \int_{\Omega} \mathsf{1}_{[X>t]}dP dt\\ &=\int_{\Omega} \int_{[0, \infty)} \mathsf{1}_{[X>t]} dt dP=\int_{\Omega} \int_{[0, X)} 1 dt dP=\int_{\Omega} X dP=E[X] \end{align*} where the first step in second line is due to Fubinni's theorem