Solution
= Solution
Because $u\mapsto(1+u/S)^{-n}$ decreases, $X_i<X_{i+1}$ exactly when $E_i>E_{i+1}$. Therefore $K\ge i$ exactly when $E_1\le\cdots\le E_i$, an event of probability $1/i!$ independent of $S$. The tail-sum rearrangement gives
$$
\mathbb E\sum_{i=1}^KS^i=\sum_{i=1}^n\mathbb E[S^i]\mathbb P(K\ge i).
$$
Since $\mathbb E[S^i]=(n+i-1)!/(n-1)!$, the $i$th term is $\binom{n+i-1}{i}$, proving the formula.