A question about jointly continuous random variables. I have this question and I get the answer for it. But I really want to know how E(Y)=E(E(Y|X))
Here is the question and answer.
Question:
An observation X is taken uniformly from (0, 1). Then, let Y be an observation taken uniformly on (X, 1). Find E[Y].
My work:

$$E[Y] = E[E[Y\mid X]] ~=~ E[(X+1)/2] = (1/2)(1/2+1) = 3/4$$

 A: The point is, since $X$ is a random variable here, we first assume it is given (and treat it like a constant) and calculate the conditional expectation. At the end, we average the result over all possibilities for $X$.
So $$\mathsf E(Y|X)=\frac{1}{2}(x+1)$$
and $$\mathsf E(Y)=\mathsf E( \mathsf E(Y|X))=\int_0^1\frac{1}{2}(x+1)dx=\frac{1}{2}(\frac{x^2}{2}+x)\biggr\vert^1_0=\frac{3}{4}$$
As pointd out in the comments, this is a standard approach refereed to as law of total (iterated) expectation(s).
A: For jointly continuous random variables , $X,Y$ with joint, marginal, and conditional density functions: $f_{X,Y}(x,y), f_X(x), f_Y(y), f_{Y\mid X}(y\mid x), f_{X\mid Y}(x\mid y)$ .
$$\begin{align}\mathsf E(\mathsf E(Y\mid X)) &= \int_\Bbb R f_X(x)\left(\int_\Bbb R y~f_{Y\mid X}(y\mid x)\operatorname d y\right)\operatorname d x \\[1ex] & = \iint_{\Bbb R^2} y\, f_{X,Y}(x,y)\operatorname d\, (x,y) \\[1ex] &= \int_\Bbb R y\, f_Y(y)\left(\int_\Bbb R f_{X\mid Y}(x\mid y)\operatorname d x\right)\operatorname dy \\[1ex] &=\int_\Bbb R y~f_Y(y)\operatorname d y \\[1ex] & = \mathsf E(Y) \\[2ex]\Box\qquad\quad\qquad \end{align}$$

So in particular, you have been given that $f_X(x)=\mathbf 1_{x\in[0;1]}$ and $f_{Y\mid X}(y\mid x) = \frac 1{1-x}\mathbf 1_{y\in[x;1], x\in[0;1]}$, then you could proceed as:
$$\begin{align}\mathsf E(Y)~&=~ \iint_{\Bbb R^2} y f_{Y\mid X}(y\mid x)f_X(x)\operatorname d y\operatorname d x
\\ &=~ \int_0^1\int_x^1 \frac y{1-x}\operatorname d y\operatorname d x
\end{align}$$
However, to avoid the work of integration we instead use that $U\sim\mathcal U[a;b] \implies \mathsf E(U)=\frac{b+a}2$ , the above Law of Iterated Expectation (or Tower Property) and the Linearity of Expectation.
$$\begin{align}\mathsf E(Y) ~&=~ \mathsf E(\mathsf E(Y\mid X)) \\[1ex]~&=~\mathsf E(\frac{1+X}{2}) \\[1ex]~&=~ \tfrac 12+\tfrac 12\mathsf E(X) \\[1ex]~&=~ \tfrac 34\\[1ex]\blacksquare\qquad&\end{align}$$
