https://en.wikipedia.org/wiki/Martingale_(betting_system) I don't think it's based on gambler's fallacy.
Suppose I have $1+2+4+8+.....+2^{9}=1023$ Dollars.
I'm about to bet on heads in the tosses of a fair coin. If the coin lands heads, I receive an amount double my bet (my original bet + profit equal to my original bet) My strategy will be:
1.Bet 1 Dollar on the first toss.
2.Double my bet on each successive toss.
3.Walk away on my first win.
So, all the possible outcomes are: $$H, TH, TTH, TTTH, TTTTH, TTTTTH, TTTTTTH, TTTTTTTH, TTTTTTTTH, TTTTTTTTTH, TTTTTTTTTT$$
I end up making a 1 dollar profit in the first 10 of these outcomes. Only in the last case I lose 1023 dollars. But it would take a miracle for $TTTTTTTTTT$ to happen with a fair coin. I know that the expected value is negative but the expected value comes into play only when I keep on betting till the end of time. My strategy is to walk away on the first win.
So, before I begin to bet, isn't it reasonable for me to believe that I'll most likely make a profit?