A game master tells his party of players that he has converted to the school of minimalism, and is going to do away with all of his dice in the campaigns they play from now on. In the place of dice, a single fair coin will now be used to resolve random events.
Say the game master decides that he wants his players to undergo a trial with probability of failure $k / 1000$, where $k$ is an integer between $1$ and $999$. He will engage a (potentially very long) sequence of coin flips: the first coin flip is worth $500$ if it comes up heads, and nothing if it comes up tails; similarly, the second coin flip is worth $250$; the third flip is worth $125$; the fourth flip is worth $62.5$, and so forth. If the sum of all the values won through heads meets or exceeds $k$, the players succeed in the trial. The game master aborts the coin flips as soon as success is guaranteed or made impossible.
For example, suppose a player attempts to scale a fence while drunk. A 67.1% chance of failure sounds fair to the game master. He proceeds to flip the coin repeatedly, coming up heads, tails, heads, tails, heads, heads. This corresponds to $500 + 125 + 31.25 + 15.625 = 671.875 \geq 671$, so the player succeeds.
As another example, a player wants to win a coin flip in-game. A 50.0% chance of failure is, of course, only natural. The game master flips the coin and it comes up tails. Now, even if the coin were to forever come up heads every single time afterward, it would result in a sum $250 + 125 + 62.5 + \dots$ that would never reach $500$ in a finite number of terms. The game master calls it, and the player fails.
Assuming $k$ is chosen uniformly randomly for each trial, how many coin flips can the players expect per trial?