All sounds good so far? Well here's where the funky part comes in. The probability of you winning $2^n is 1/(2^n). This means that when you calculate the expected value of the game, where the expected value tells you how much you are likely to win on average, the expected value is infinity!?! This can be seen as follows
# tosses (n) | Winnings | Probability | Expected Payoff |
1 | $2 | 1/2 | $1 |
2 | $4 | 1/4 | $1 |
3 | $8 | 1/8 | $1 |
4 | $16 | 1/16 | $1 |
5 | $32 | 1/32 | $1 |
... | ... | ... | ... |
n | $2^n | 1/(2^n) | $1 |
Now, if you consider that you could be lucky enough, or not, that the coin would keep coming up heads indefinitely you could win an indefinitely large sum of money. This means that to calculate the expected value of the game, we must sum the expected payoff from each possible outcome, namely sum(2^n * 1/(2^n)) where n=1,2,3,... As can be seen from the table this is sum(1) n=1,2,3,... which is infinity. This means that whatever fixed amount of money one has to pay to get in on this game, you should always do it.
Of course this isn't right, we know this intuitively as the odds on getting 5 heads in a row is pretty remote. There is a great website that simulates this game
http://www.mathematik.com/Petersburg/Petersburg.html
A few people have proposed solutions to the paradox. The first was Bernoulli who proposed that the value of money decreases logarithmically with how much you have. That the difference to between having one billion and two billion is realistically less than the difference between one billion and one million. This doesn't solve the problem however as the winnings can be altered to increase to cancel the logarithmic decrease in the value of money. The other proposed "solution" is that no casino has an infinite amount of money to give you, the game has a maximum winnings. Capping the winnings does fix the problem, but you almost get the sense that this is somehow cheating a little.
Here are some great links for a much more in depth (and prettier) analysis of the paradox:
http://plato.stanford.edu/entries/paradox-stpetersburg/
http://en.wikipedia.org/wiki/St._Petersburg_paradox