Martingale concept. Can I always win in a fair game? Suppose the following game: You start with $1€$. 


*

*Toss a coin. If it is obtained "head", you win $1€$, and stop the game; otherwise, you lose $1€$, and continue in step 2.

*Toss a coin. If it is obtained "head", you win $2€$, and stop the game; otherwise, you lose $2€$, and continue in step 3.

*Toss a coin. If it is obtained "head", you win $4€$, and stop the game; otherwise, you lose $4€$, and continue in step 4.
$\quad \cdots$
$\quad n$. Toss a coin. If it obtained "head", you win $2^{n-1}€$, and stop the game; otherwise, you lose $2^{n-1}€$, and continue in step $n+1$. 
$\quad \cdots$
Note that, in the end, you will have $2€$.
Let's analyze this game in a probabilistic way. Define $\xi_i=1$ if you obtain "head" in step $i$; and $-1$ otherwise. We have $P(\xi_i=1)=P(\xi_i=-1)=1/2$. Let $H_n=2^{n-1}$ if $\xi_1=\ldots=\xi_{n-1}=-1$; and $0$ otherwise. Then the money we have at time $n$ is 
$$ Z_n=1+\sum_{i=1}^n H_i\xi_i. $$
It turns out that $\{Z_n\}_{n\geq0}$ is a martingale with respect to the filtration generated by $\xi_1,\xi_2,\ldots$
I cannot understand this. If a martingale represents a fair game (you do not know if you will win or lose), how is it possible in this case that you win for sure $2€$ in the end?
 A: You have a process where $X_{t+1}=X_t+2^t$ with probability $1/2$ and $X_t-2^t$ with probability $1/2$ and each win/loss is independent. You define the stopping time $\tau$ to be the first time that you win the game. Then if $X_0=0$ then $X_\tau=1$. Thus you can always guarantee winning something even though the game is fair.
The issue is, to play this way, you have to be allowed to play the game for an arbitrarily long time, and you have to be allowed to go into an arbitrarily large amount of debt (or come into the casino with infinite money). If either of those conditions is omitted then you introduce games where you ultimately lose, and the average drops back to zero. 
The theorem that ensures this is called the optional stopping theorem, and it has nontrivial hypotheses about the properties of the stopping time.
Incidentally, the betting strategy you are describing is called the martingale betting strategy; to my understanding it is the origin of the word "martingale" in mathematics. Even in view of the above, it's not as bad as it sounds. Say you cap yourself at 10 losses before you go home. Then with a probability $1023/1024$, you win one money unit. It's just that the rest of the time, you lose 1024 money units.
