St. Petersburg Paradox
Solution 1:
Suppose you pay a trillion dollars to enter the game. The following table contains some of the values of the net payoff you can possibly end up with and the corresponding probabilities:
\begin{align*} \begin{array}{rr} 1/2&-\,1\mathord{,}000\mathord{,}000\mathord{,}000\mathord{,}000\\ 1/4&-\,999\mathord{,}999\mathord{,}999\mathord{,}998\\ 1/8&-\,999\mathord{,}999\mathord{,}999\mathord{,}996\\ 1/16&-\,999\mathord{,}999\mathord{,}999\mathord{,}992\\ \vdots\\ 1/2^{10}&-\,999\mathord{,}999\mathord{,}999\mathord{,}488\\ \vdots\\ 1/2^{20}&-\,999\mathord{,}999\mathord{,}475\mathord{,}712\\ \vdots\\ 1/2^{30}&-\,999\mathord{,}463\mathord{,}129\mathord{,}088\\ \vdots\\ 1/2^{40}&-\,450\mathord{,}244\mathord{,}186\mathord{,}112\\ 1/2^{41}&99\mathord{,}511\mathord{,}627\mathord{,}776\\ 1/2^{42}&1\mathord{,}199\mathord{,}023\mathord{,}255\mathord{,}552\\ \vdots\\ 1/2^{50}&561\mathord{,}949\mathord{,}953\mathord{,}421\mathord{,}312\\ \vdots\\ 1/2^{100}&633\mathord{,}825\mathord{,}300\mathord{,}114\mathord{,}114\mathord{,}699\mathord{,}748\mathord{,}351\mathord{,}602\mathord{,}688\\ \vdots\\ 1/2^{200}&803\mathord{,}469\mathord{,}022\mathord{,}129\mathord{,}495\mathord{,}137\mathord{,}770\mathord{,}981\mathord{,}046\mathord{,}170\mathord{,}581\mathord{,}301\mathord{,}261\mathord{,}101\mathord{,}496\mathord{,}890\mathord{,}396\mathord{,}417\mathord{,}650\mathord{,}688\\ \vdots \end{array} \end{align*}
The paradox lies in the following observation. If you take out a loan of one trillion dollars to play this game, you will go bankrupt with a very large probability. However, once in a lifetime (not even of a human but of the universe) you win an unspeakably large amount of money, so large you can't even imagine.
In the light of this observation, a reasonable person would never play this game only once. It is worth playing only if you can play it indefinitely, while you have access to unlimited borrowing. What will happen is that you will keep playing for billions of years, accumulating an enormous debt using your infinite line of credit. But after a very long time, you will win so much money that is sufficient for you to pay off this large debt and still purchase the whole world. As @IanColey put it, this is because the chances of winning so much money are very, very tiny, but the payoffs associated with these very, very tiny probabilities are much, much, much more enormous than the probabilities are tiny.
Solution 2:
Expectations are statements about behavior of a random variable as you draw from it infinitely many times. If you had an infinite bankroll, you could play the game infinitely many times at $1,000,000,000,000 a pop, winning money in the long run (even if you lost 10 times in a row). At the same time, we are also assuming (rather incorrectly) that the bankroll of the person handing out the reward is infinite. If either of these assumptions is invalidated, new dynamics enter the equation. If you don't have infinite money, you must consider risk (e.g. if the bet is as big as your entire net worth, you have a 50/50 of losing it all in one toss), and if the person offering the game has finite money, the expectation of playing the game to infinity cannot be infinity since the game ends (as well as your opportunity to accrue new winnings) when he runs out of money.
Wikipedia has a small overview of the mathematical reason it is infinity as well as the problems I just brought up - as well as alternative explanations.
http://en.wikipedia.org/wiki/St._Petersburg_paradox
Solution 3:
The game describes a random variable $X$, which represents the amount of money you'll get by playing the game. You don't know what the outcome will be, that's why $X$ is a random variable. We do know however what the values of $X$ may be, namely, anything of the form $2^n$. We also know what is the probability you'll get $2^{n-1}$, namely it is precisely $\frac{1}{2^{n}}$. Thus $P(X=2^{n-1})=\frac{1}{2^{n}}$.
Now, this is of course an ideal game since in reality you will never ever get $2^{100000000000000000000} $ dollars. not because the probability of that happening is very small, but simply because no such amount of money exists. Nonetheless, we may contemplate the properties of this ideal game and deduce properties of any approximation of it, namely when actually playing this game.
The expectation of $X$ (which is $\infty $ by the computation you quote) is a mathematical entity that represents, in some sense, what we expect the value of $X$ to be. This is very very crude though and needs to be interpreted correctly, especially when the expectation is $\infty $.
In the case above, the expectation being $\infty $ means the expected gain from playing the game is $\infty$, roughly in the following sense. Suppose that in order to play the game you have to pay a finite amount $K$ for each time you want to play. If you play long enough (may be a very very long time!) than your total wins will be greater that your total losses, no matter what $K$ is (as long as it is fixed for the entire duration of the game). In this sense, it is mathematically justified to be willing to pay any fixed amount of money to play the game.
Of course the idealistic nature of the mathematical situation neglects various humanly important factors such as utility, which is commonly how this paradox is solved.
Remark: The two envelope paradox, which is a bit related, is much more difficult to resolve.