The definition of the expected value I wondered why the expected value defined by the lebesgue integral is a reasonable way to define the weighted average of a random variable, which the expected value represents. What would be a good way to clarify that relation/justify the definition? The discrete cases are very clear, I just wondered about the continuous cases. Thank you in advance!
Edit: The definition I know is the following. Let $X:\Omega \to \mathbb{R}$ be a regular random variable on the probability space $(\Omega,A,P)$. Then the expected value is defined as $E(X):= \int X dP$.
 A: The integral (whether Riemann or Lebesgue) is a way to make sense of the area under a curve. They agree when both are defined, which covers most of the interesting cases for probability. 
The Riemann integral, calculated as the limit of the areas under step functions, clearly generalizes the discrete case, which you understand. Think about how the  mean calculated from a histogram approximates the mean calculated from the underlying continuous distribution.
A: Given a probability space $(\Omega,\mathcal F,\mathbb P)$, a random variable is a measurable function $X:\Omega\to\mathbb R$. When the integral 
$$
\int_\Omega |X(\omega)|\ \mathsf d\mathbb P(\omega)
$$
is finite, we say that $X$ is integrable and define the expected value by
$$
\mathbb E[X] = \int_\Omega X(\omega)\ \mathsf d\mathbb P(\omega).
$$
Now, we generally aren't given an explicit sample space or probability measure when working with random variables, but rather a distribution function $F_X:\mathbb R\to[0,1]$ which satisfies $F_X(x) = \mathbb P(\omega\in\Omega: X(\omega)\leqslant x)$ for $x\in\mathbb R$. Assuming that $\mathbb P(X\geqslant 0)=1$, we can apply Tonelli's theorem to the map $(\omega,x)\mapsto \mathsf 1_{\{X(\omega)>x\}}$ and the $\sigma$-finite product measure $\mathbb P\otimes m$ on $\Omega\times\mathbb R_+$ (where $m$ denotes Lebesgue measure). This yields
$$
\mathbb E[X] = \int_\Omega X(\omega)\ \mathsf d\mathbb P(\omega) = \int_\Omega \int_0^{X(\omega)} \ \mathsf dx \ \mathsf d \mathbb P(\omega) = \int_\Omega\int_{\mathbb R_+} \mathsf 1_{\{X(\omega)>x\}}\ \mathsf dx\ \mathsf d\mathbb P(\omega),
$$
and on the other hand
$$
\int_{\mathbb R_+}\int_\Omega\mathsf 1_{\{X(\omega)>x\}}\ \mathsf d\mathbb P(\omega)\ \mathsf dx = \int_{\mathbb R_+} \mathbb E[\mathsf 1_{\{X(\omega)>x\}}]\ \mathsf dx = \int_{\mathbb R_+} \mathbb P(X>x)\ \mathsf dx.
$$
This result can be generalized to random variables taking negative values without much additional effort:
$$
\mathbb E[X] = \int_{-\infty}^0 \mathbb P(X<x)\ \mathsf dx + \int_0^\infty \mathbb P(X>x)\ \mathsf dx.
$$
Note that these results hold for any integrable random variable, be it continuous, discrete, a mixture, or none of the above. So I recommend taking the time to understand this derivation, especially since the formulas are quite useful in certain situations.
