Ms. A selects a number $X$ randomly from the uniform distribution on $[0, 1]$. Then Mr. B repeatedly, and independently, draws numbers Ms. A selects a number $X$ randomly from the uniform distribution
on $[0, 1]$. Then Mr. B repeatedly, and independently, draws numbers
$Y_1, Y_2, ...$ from the uniform distribution on $[0, 1]$, until he gets a number
larger than $\frac{X}{2}$, then stops. The expected sum of the number Mr. B draws, given $X = x$, equals?
The answer to this is $\frac{1}{(2-x)}$. I got the expected number of draws as $ln 4$ by taking $Z$ as a random variable for the number of draws which follows geometric distribution whith parameter $p= 1 - \frac{x}{2}$. But I don't know how to calculate for expected sum of $Y_{i}$ . Any help would be appreciated.
 A: Although, you didn't include self-study tag, I first give you two hints and then full solution. You may stop reading after first or second hint and try youself.
Hint 1:
For $a \in (0,1)$ we have $$\sum_{m=0}^{\infty} ma^m = \frac{a}{(1-a)^2}$$
Hint 2:
Let $K$ be number of numbers drawn by Mr. B. And let your "target variable", $E(Y_1+\ldots+Y_K | X=x)$ be denoted by $Z$. Notice, this is a random variable, not a real number (since $K$ is a random variable). Then, by the law of total expectation, $E(Z) = E(E(Z|K))$.
Full solution:
$K$ follows, as you mentioned, geometric distribution with probability of success $p=1-\frac{x}{2}$. So 
$$E(Z) = E(E(Z|K)) = \sum_{k=1}^{\infty} E(Z|K=k)P(K=k)$$ 
and $$P(K=k)=(1-p)^{k-1}p = \left(\frac x2\right)^{k-1}\left(1-\frac x2\right)$$.
Let's focus on $E(Z|K=k)$. It is now $E(Y_1+\ldots+Y_k | X=x, K=k)$. Notice lower case $k$ here!!! Since $Y$'s are independent this equals
$$E(Y_1 | X=x, K=k)+\ldots+E(Y_k | X=x, K=k)$$. 
Conditioning on $X=x$ and $K=k$ means that $Y_1, \ldots, Y_{k-1}$ are drawn uniformly from $\left[0,\frac x2\right)$ and $Y_k$ is drawn uniformly from $\left(\frac x2, 1\right]$.
So $$E(Y_1 | X=x, K=k)=\ldots=  E(Y_{k-1} | X=x, K=k) = \frac x4$$
and $$E(Y_k | X=x, K=k) = \frac{1+\frac x2}{2} = \frac{2+x}4$$
Putting all this together:
$$ E(Z|K=k) = (k-1)\frac x4 + \frac{2+x}4$$
And
$$E(Z) =  \sum_{k=1}^{\infty} \left( (k-1)\frac x4 + \frac{2+x}4 \right) P(K=k) =   \sum_{k=1}^{\infty}  (k-1)\frac x4 P(K=k) + \sum_{k=1}^{\infty}  \frac{2+x}4  P(K=k)$$ 
Second part is easy (last equality uses the fact that sum of probability mass function adds up to 1):
$$\sum_{k=1}^{\infty}  \frac{2+x}4  P(K=k) = \frac{2+x}4\sum_{k=1}^{\infty}    P(K=k)= \frac{2+x}4 $$ 
To get this, you can also use the fact, that Mr. B always draws one last number from $\left(\frac x2, 1\right]$, no matter what value of $K$ took.
First part is only a bit harder:
$$ \sum_{k=1}^{\infty}  (k-1)\frac x4 P(K=k) =  \sum_{k=1}^{\infty}  (k-1)\frac x4 \left(\frac x2\right)^{k-1}\left(1-\frac x2\right)$$
Move everything that do not depend on $k$ in fornt of sum to get: $$  \frac x4 \left(1-\frac x2\right)\sum_{k=1}^{\infty}  (k-1) \left(\frac x2\right)^{k-1}$$
Introduce $m=k-1$:
$$  \frac x4 \left(1-\frac x2\right)\sum_{m=0}^{\infty}  m \left(\frac x2\right)^m$$
Use hint 1 with $a=\frac x2$:
$$  \frac x4 \left(1-\frac x2\right)\frac{\frac x2}{(1-\frac x2)^2}$$
To finally get
$$  \frac {x^2}{8(1-\frac x2)} =\frac {x^2}{8(\frac {2-x}2)} =\frac {x^2}{4(2-x)}   $$
And add second part (the easy one):
$$ \frac {x^2}{4(2-x)}  + \frac{2+x}4  = \frac {x^2}{4(2-x)}  + \frac{(2+x)(2-x)}{4(2-x)} = \frac {x^2 + (4-x^2)}{4(2-x)} = \frac 4{4(2-x)} = \frac 1{2-x}$$
WHOAH!!!!
A: Another angle of solution (summing not with P(K=k) but P(K>=k)):
$$\begin{array}\\
E(\sum Y_k) = \sum E(Y_k) & = \sum_{k=1}^\infty E(Y_k|K>=k) \cdot  P(K>=k) \\
& =   \sum_{k=0}^\infty  \frac{1}{2} \cdot \left(\frac{x}{2} \right)^k \\
& = \frac{1}{2-x} 
\end{array}$$
