# Lebesgue integral - area under the curve

Could anyone explain in simple terms why Lebesgue integral of a discrete function can be calculated and give non-zero value? For example, expected value - if the random variable is discrete, then the integral

$$\operatorname{E} [X] = \int_\Omega X \, \mathrm{d}P = \int_\Omega X(\omega) P(\mathrm{d}\omega)$$

simplifies to a summation

$$\operatorname{E}[X] = \sum_{i=1}^n x_i\, p_i$$

even though the area under the curve of this function is zero, so a Riemann integral wouldn't exist or be equal to zero.

Does it have something to do with the fact that probability is a measure? So instead of the 'area' being the size of a set, we choose the size of a set to be the probability?

The Lebesgue integral of a positive constant $c$ on a set $A$ is $c$ multiplied by the measure of $A$. If the measure is singular it might happen that even a single point $A=\{p_i\}$ has positive measure. If the measure is the Lebesgue measure, then the integral is the area of the rectangle.