Let $ X_1, X_2, \ldots $ be independent and identically distributed random variables, each following a uniform distribution on the interval $[0,1]$. Define the random variable $ S $ as follows:
$$ S = \sum_{i=1}^{N} \frac{X_i}{2^i}, $$
where $ N $ is the smallest positive integer $ k $ such that $ X_k < X_{k+1} $. If no such $ k $ exists, then $ N = \infty $. Determine $\mathbb{E}[S]$.
I have tried to use the total expectation formula $\mathbb{E}[S] = \mathbb{E}(\mathbb{E}(S |N))$ and I can figure out:
$$ \Pr(N = n) = \Pr(X_1 \ge X_2 \ge \dots \ge X_n, X_n < X_{n + 1}) = \dfrac{n}{(n + 1)!} $$
But I am having difficulties getting $\mathbb{E}(S |N = n) $ for each $n$
I also wonder if there is any other approaches to this question instead of calculating $\mathbb{E}(\mathbb{E}(S |N))$.