A game costs \$100 to play. Toss a coin repeatedly, and win \$1 if you get heads for the first time, \$2 if you get heads both of the first two times, \$4 all of the first three times, \$8, and so on. But the game stops if you withdraw, or get tails.
You decide to withdraw after the K-th round, if you manage to keep rolling heads that long. Calculate expected winnings for each k.
K=1, E[W]= (0.5*0) + (0.5*1) = 0.5
K=2, E[W]= (0.5*0) + (0.25*1) + (0.25*2) = 0.75
K=3, E[W]= (0.5*0) + (0.25*1) + (0.125*2) + (0.125*4) = 1.
$\vdots$
I can't understand how the expected gains was calculated.