I am solving some problems from John A. Gubnar's (Probability and Random Processes for Electrical and Computer Engineers). I also got the solution manual. In the following problem, I am unable to understand how $E[Y|X=m]=m/\lambda$ is computed.
Question
Let $X \sim \operatorname{Poisson}(\mu)$, and suppose that given $X=m, Y \sim \operatorname{Erlang}(m,\lambda)$. Find the correlation $E[XY]$
Solution
Using the formulas:
Substitution Law for Conditional Expectation:
$E[g(X,Y)|X=x_{i}]=E[g(x_{i},Y)|X=x_{i}]$
and Law of Total Probability of Expectation:
$E[g(X,Y)]=\sum_{i} E[g(X,Y)|X=x_{i}].p_{x}(x_{i})$
Solving using above formulas
$E[XY]=\sum_{m=0}^\infty E[XY|X=m]\cdot p(X=m)$
$E[XY]=\sum_{m=0}^\infty E[mY|X=m]\cdot p(X=m)$
$E[XY]=\sum_{m=0}^\infty mE[Y|X=m]\cdot p(X=m)$
The value of $E[Y|X=m]=m/\lambda$. (How is this $m/\lambda$ computed?)
$E[XY]=\sum_{m=0}^\infty m(m/\lambda)\cdot p(X=m)$
$E[XY]=\frac{1}{\lambda}E[X^2]=\frac{\mu+\mu^2}{\lambda}$, since $X \sim \operatorname{Poisson}(\mu)$.
(Extended from comments)
Given $X = m$, the distribution of $Y$ is $\operatorname{Erlang}(m,\lambda)$. That said, computing $\Bbb{E}[Y \mid X = m]$ boils down to computing the expectation of this distribution. Notice that $\operatorname{Erlang}(m,\lambda)$ is specified by its pdf
$$ f(x) = \frac{\lambda^m x^{m-1} e^{-\lambda x}}{(m-1)!} \mathbf{1}_{\{x \geq 0 \}}, $$
from which the expectation is computed by
$$ \int_{0}^{\infty} x \cdot \frac{\lambda^m x^{m-1} e^{-\lambda x}}{(m-1)!} \, \mathrm{d}x \overset{(\lambda x = t)}= \frac{1}{(m-1)!\lambda} \int_{0}^{\infty} t^m e^{-t} \, \mathrm{d}t = \frac{m}{\lambda}. $$
Alternatively, it can be proved that $\operatorname{Erlang}(m,\lambda)$ is realized as the sum of $m$ independent exponential variables $T_1, \cdots, T_m$ of rate $\lambda$. So if $Z \sim \operatorname{Erlang}(m,\lambda)$, then
$$ \Bbb{E}[Z] = \Bbb{E}[T_1 + \cdots + T_m] = m \Bbb{E}[T_1] = \frac{m}{\lambda}. $$