Why does the identity $\mathbb{E}(X) = \mathbb{E}\left(\int \mathbb{1}_{u \leq X}du\right)$ hold? I'm reading on Hoeffding's covariance identity, the proof of which is neatly covered here, or, in a similar manner, in this MSE post, but I can't seem to fully understand the trick/property used there. 
I.e., assume $(X_1, Y_1)$ and $(X_2, Y_2)$ are two independent vectors with identical distribution. The key point in the proof is to note that we can write
$$ \mathbb{E}[(X_1 - X_2) (Y_1 - Y_2)]$$ as 
$$ \mathbb{E}\left(\iint_{\mathbb{R}\times\mathbb{R}} [\mathbb{1}_{u\leq X_1} - \mathbb{1}_{u \leq X_2}] \cdot [\mathbb{1}_{v\leq Y_1} - \mathbb{1}_{v \leq Y_2}]\,du\,dv \right)$$
Why does this hold? 

For any point $\omega$ in the sample space, we have
$$ \int_{\mathbb R \times \mathbb R} [1_{u\leq X_1(\omega) } - 1_{u \leq X_2(\omega)}][1_{v \leq Y_1(\omega)} - 1_{v \leq Y_2(\omega)}] \ du dv =(X_1(\omega) - X_2(\omega))(Y_1(\omega)-Y_2(\omega)) $$
[For example, if $X_1(\omega) > X_2(\omega)$ and $Y_1(\omega) > Y_2(\omega)$, then
\begin{align} \int_{\mathbb R \times \mathbb R} [1_{u\leq X_1(\omega) } - 1_{u \leq X_2(\omega)}][1_{v \leq Y_1(\omega)} - 1_{v \leq Y_2(\omega)}] \ du dv &=\int_{\mathbb R \times \mathbb R}1_{X_2(\omega) < u \leq X_1(\omega)}.1_{Y_2(\omega) < v \leq Y_1(\omega)} \ dudv \\ &= \int_{X_2(\omega)}^{X_1(\omega)}\int_{Y_2(\omega)}^{Y_1(\omega)} 1 \ dudv \\ &=(X_1(\omega) - X_2(\omega))(Y_1(\omega)-Y_2(\omega))\end{align}
It's not to hard to find analogous arguments for the cases where $X_1(\omega) \leq X_2(\omega)$ or $Y_1(\omega) \leq Y_2(\omega)$.]
Taking expectations on both sides gives the desired result.
