Expected value until a success? Suppose we have the a game with a 5-sided unfair die (just to make the probabilities easier to sum to 1), each side having a different payout.
For each side $ x \in \{1,2,3,4\}$ we have the corresponding payouts $ \$1,...,\$4$. However, if the die lands in $5$ there's no payout and the game is over.
Each side, respectively, has probability $P(X=x) = \{0.15, 0.2, 0.25, 0.3, 0.1\}$
What's the expected payout for the game?
If we directly apply the expected value, we would get something like
$$\sum_x x_ip(x_i)= \$2.5 $$
However, the meaning behind calculating the expected value this way seems to only capture the expected value for the game for 1 trial.
How would one approach such a problem?
 A: Recursion
We can define the expected value of the game in a recursive manner. Let's assume that the expected benefit from the game (all rolls until the game ends) is x.
Using the probabilities you give for rolling {0.15,0.2,0.25,0.3,0.1} and the winnings of {\$1, \$2, \$3, \$4, [game ends]}, the expected value of the roll is $2.5 plus the value of that 90% chance of continuing the game - and given the rules of this game, it's clear "the right to continue the game" is exactly as valuable as "the right to play the game" - if the game hasn't ended, at the start of the second (or any other future) roll my potential future winnings (excluding the winnings of previous rolls) are exactly the same as in the beginning of the game.
So we can define the value of the game before the first roll is made as x=$2.5+0.9x, recursively referring to the value itself - and the resulting equation is trivially solvable to x=$25.
In essence this is equivalent to Polettix's answer, but IMHO this approach is much simpler to understand.
A: I would have liked to comment but I still can't... so I'll give a complete answer hoping that I'm not spoiling any homework.
I'd start saying that the "winning" sides of this five-sided unfair die are a distraction. We can re-arrange the calculations and obtain the expected value for a single roll:
$$ E_s = 0.9 \cdot \sum_{i=1}^{4}{x_i \cdot \frac{p(x_i)}{\sum_{i=1}^{4}{p(x_i)}}} + 0.1 \cdot 0 = 0.9 \cdot E_w$$
where $E_w$ is the expected value for the win under the assumption that we win (which happens with probability $0.9 = \sum_{i=1}^{4}{p(x_i)} = 1 - 0.1$).
It's like having a loaded coin, where you win $E_w$ with probability $0.9$ and get nothing otherwise.
In the "extended game" case (i.e. winning allows us to continue), if we win the first roll we are getting an expected value of $E_w$ (for the first successful roll) plus our expected value for... an undefined number of rolls, i.e. what we are after. In other terms, the expected value $E_m$ for multiple rolls will be:
$$ E_m = 0.9\cdot(E_w + E_m)$$
$$ E_m = \frac{0.9 \cdot E_w}{0.1} = \frac{E_s}{0.1} = \frac{E_s}{p(x_5)}$$
From another angle, we might observe that the number of trials to get one "success" (in this case, losing!) when repeatedly tossing our loaded coin can be modeled by a geometric distribution. Hence we might just multiply the expected value for a single toss $E_s$ by the average number of tosses needed to get this "successful failure", which is $\frac{1}{p(x_5)}$, and obtain the same result.
A: Simulation, per Comment: At each iteration, the die is rolled 400 times,
but only the rolls up to the first observed 5 are counted. Then
the payout w is computed, ignoring the trial on which the 5 occurred.
I chose 400 rolls because (with very high probability) that is enough
to get a 5. [Sloppy programming, wasteful of random numbers, but runs quickly.]
set.seed(1237)  # for reproducibility
pr = c(.15, 0.2, 0.25, 0.3, 0.1)
m = 10^6;  w = h = numeric(m)
for(i in 1:m) {
 x = sample(1:5, 400, rep=T, p=pr)
 h[i] = match(5,x); s = h[i]       # stopping point
 w[i] = sum(x[1:s])-5
 }
mean(w); mean(h)
[1] 25.00693     # aprx 9*2.777778 = 25; avg total payout
[1] 10.00337     # aprx 1/.1 = 10; avg trial number at stop

Note: Can look at summary(h) to see it's consistent with a geometric
distribution (and contains no NAs from almost-impossible runs of
400 without at 5).
summary(h)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      1       3       7      10      14     143 

A: There's a .9 chance that you'll win 2.5 EV. You could also win a second 2.5. The probability of that, contingent on winning the first 2.5, is .9, for a total probability of .9^2. You can continue winning 2.5, with the probability of the nth win being .9^n. So you have
$\sum (2.5*.9^n) = 2.5\sum .9^n$, which is a geometric series. Using the formula $\sum r^n = \frac 1 {1-r}$, you get that the total EV is 2.5*10 = 25.
You can also use the algebra mentioned in other answers: EV = 2.5+.9Ev -> EV = 25. This is of course simpler to do, but I decided to post both methods as there's a nonzero chance that someone will read this answer and it will make the geometric series formula slightly less mysterious.
PS You could have a six-sided die where 5 and 6 have probability .05 each, and either results in a loss.
