Derivation (expectation vanishes iff non-negative random variable almost certainly vanishes)
Suppose $\expect(X) = 0$. By Markov's inequality, $$ \prob\Big(X\geq\frac1n\Big) \leq n\,\expect(X) = 0$$ so $$ \prob(X>0) = \prob\Big(\bigcup_n\big\{X\geq\frac1n\big\}\Big) = 0 $$ by continuity. Hence $\prob(X=0) = 1$.
Conversely suppose $\prob(X=0) = 1$. Using the identity $$ X \leq \fsum n1\infty 1_{\set{X>0}} $$ ($0\leq 0$ for $X=0$, and $X\leq\infty$ for $X>0$), taking the expectation gives $$\expect(X) \leq \sum_{n=1}^\infty \prob(X>0) = 0$$ so $\expect(X)=0$.