Suppose we are playing a game. Game has 5 levels, if you lost level, you start over from zero level. At the end of every level you have some dollars for you. Assume it is 1, 2, 3, 4, 5 for our five levels.
When you lost, all dollars at the end of the levels are restored. Your dollars is left at the beginning of the level where you've lost. All another money are erased.
Probabilities to get through levels are all equal to 1/2.
Q: How much money do you expect to have when you win the game?
So, definitely you will have at least 1+2+3+4+5 dollars (Base=15), but if you can make loops at every level, e.g. you reach third level and then lose and reach it again, collect money from last time, and so on.
So, you will have Base plus loops money.
I tried to compute expected gain from possible loop on every level. At level 1 probability of a loop is lost then win = 1/2 * 1/2, at level 2 is lost then win then win = 1/2^3 and so on. So i've got a formula:
$1+\frac{1}{3}\times 1+2+\frac{1}{7}\times(1+2)+3+\frac{1}{15}\times(1+2+3)+4+\frac{1}{31}\times(1+2+3+4)+5 = 16.4844...$
The right answer is $16.6268...$.
Where is an error?
Let $X_n$ be the number of levels attempted in game $n$, $n=1,2,\ldots$. Then the $X_n$ are iid with distribution $$\mathbb P(X_1=j) = \begin{cases} (1-p)p^{j-1},& j=1,2,3,4\\ p^4,& j=5.\end{cases} $$ The expected reward from a lost game is $$\mathbb E\left[X_n\cdot \mathsf 1_{\{1,2,3,4\}}(X_n)\right] = \sum_{j=1}^4 j(1-p)p^{j-1} = (1-p)(1+2p+3p^2+4p^3).$$ Let $$\tau=\inf\{n: X_n=5\},$$ then $\mathbb E[\tau] = p^4 + (1-p^4)(1+\mathbb E[\tau])$ and hence $\mathbb E[\tau]=\frac1{p^4}$. As $$\{\tau\leqslant n\}=\bigcup_{k=1}^n \{X_k=5\}\subset\sigma(X_1,\ldots,X_n),$$ $\tau$ is a stopping time and therefore by Wald's identity, the expected total reward is $$\begin{align} \mathbb E\left[X_n\cdot \mathsf 1_{\{1,2,3,4\}}(X_n)\right]\mathbb E[\tau] &= (1-p)(1+2p+3p^2+4p^3)\frac1{p^4}\\ &= \frac{(1-p) \left(10 p^3+1\right)}{p^4}.\end{align}$$ For $p=1/2$, the expected total reward is $18$.