How to prove $\prod_{i=1}^{\infty} (1-a_n) = 0$ iff $\sum_{i=1}^{\infty} a_n = \infty$?

Use $1-a_n \leq e^{-a_n}$ for $ \sum_{i=1}^{\infty} a_n = \infty \implies \prod_{i=1}^{\infty} (1-a_n) = 0$

For the other direction, define independent uniform random variables $(U_n)_{n\geq 1}$ and $A_n =\{U_n < a_n\}$, then we have $\prod_{n=1}^{+\infty}P(A_n^c) = 0$

Use Borel-Cantelli lemma like here enables to conclude.

For a non-pobabilistic proof, see proof and the first comment here