Doubling the bet every time until one wins is a mathematically unsound strategy, and can be proven with expected value mathematics.
And for good measure, here's the proof.
Suppose I have a game where we flip a coin, and if it's heads, I win, and if it's tails, you win, and we each bet a dollar. You lose, so you try again with a $2 bet, and lose again, so you bet $4. You can keep this up until you run out of money, and can't double your bet again. The plan is that you walk away on a win.
Let's say you have $32 total to bet.
For the first bet, you put in $1 and have an expected winning value of $0.
Math: E[x] = (1/2)*(-1) + (1/2)*(1) = 0 (Meaning, you have a 1/2 chance of losing a dollar, and 1/2 chance of winning a dollar, so your expected win is mathematically 0.)
If you lose, you now have $31 left. You have a 1/2 chance of winning at this stage, and you get $1 if you win.
For the second bet, assuming you lost the first bet, you put in $2 and have an expected winning value of $0.
Math: E[x] = (1/2)*(-2) + (1/2)*(2) = 0
If you lose, you now have $29 left. You have a 1/4 chance of losing in the first stage and winning at this stage, because (1/2)^2 = 1/4, and you get $2 if you win, but you've already lost $1, so you only get $1 if you win at this stage.
For the third bet, assuming you lost the second bet, you put in $4 and have an expected winning value of $0.
Math: E[x] = (1/2)*(-4) + (1/2)*(4) = 0
If you lose, you now have $25 left. You have a 1/8 chance of losing in the first two stages and winning at this stage, because (1/2)^3 = 1/8, and you get $4 if you win, but you've already lost $3, so you only get $1 if you win at this stage.
For the fourth bet, assuming you lost the third bet, you put in $8 and have an expected winning value of $0.
Math: E[x] = (1/2)*(-8) + (1/2)*(8) = 0
If you lose, you now have $17 left. You have a 1/16 chance of losing in the first three stages and winning at this stage, because (1/2)^4 = 1/16, and you get $8 if you win, but you've already lost $7, so you only get $1 if you win at this stage.
For the fifth bet, assuming you lost the fourth bet, you put in $16 and have an expected winning value of $0.
Math: E[x] = (1/2)*(-16) + (1/2)*(16) = 0
If you lose, you now have $1 left and CANNOT double again, so you lose for good. You have a 1/32 chance of losing in the first four stages and winning at this stage, because (1/2)^5 = 1/32, and you get $16 if you win, but you've already lost $15, so you only get $1 if you win at this stage.
.....
Your chance of winning in at least 1 of the 5 bets (and therefore walking away a winner) is 31/32 (math: 1/2 + 1/4 + 1/8 + 1/16 + 1/32 = 31/32). And you get $1 if you win.
Your chance of losing all five bets (the only way to be a loser in this strategy) is 1/32 (math: (1/2)^5 = 1/32). And you lose $31 if lose.
So if we calculated your expected value of the whole game, we get:
E[x] = (31/32)*(1) + (1/32)*(-31) = 0
In other words, not only is your expected value of each bet zero, but your expected value from this whole game is zero too. You have a very likely chance of winning $1, and a very unlikely chance of losing $31, but mathematically, if you keep playing this, you'll end up with what you started. More realistically, in a casino, since no games are 50/50, your expected value is negative, and you eventually end up broke if you keep playing.
The same math applies no matter how much you start with and how much the initial bet is, as long as you start with a finite amount. And it doesn't make sense to start with an infinite amount, because a) there's no such thing as infinite money and b) if you had infinite money then gambling is irrelevant.
So, the strategy of doubling on a loss is not viable.