Proof (Jensen's inequality)

We'll use the property of convex functions that for all $m\in I$, there exists $a,b\in\R$ (that defines a line $y=ax+b$) such that $$ am+b = f(m)\quad\text{and}\quad ax+b\leq f(x)\quad\forall x\in I.$$

Apply this to $m=\expect(X)$: $$\begin{align*} \expect(f(X)) &\geq \expect(aX+b) \\ &= a\expect(X) + b \\ &= f(\expect(X)). \end{align*}$$

Suppose $f$ is strictly convex and equality holds. This means $$ am+b = f(m)\quad\text{and}\quad ax+b<f(x)\quad\forall x\in I\setminus\set m.$$ Equality holds iff $\expect(f(X) - aX - b)=0$, which is the expectation of a non-negative random variable, so $$ \prob(f(X) - aX - b = 0) = 1 \iff \prob(X=m) = 1$$ for some $m$.