Our expectations and integrals are examples of Lebesgue integrals. How do these relate to the Riemann integrals we learned about in calculus?
The group of real numbers under addition $(\mathbb R, +)$ is an example of a locally compact group. Any Locally compact group $(G,+)$ can be topologized and the $\sigma$-algebra generated by the $\pi$-system of open sets will be called the Borel $\sigma$-algebra and denoted $\mathcal B(G)$. This is consistent with our notation for $\mathbb R$ and $\mathbb R^N$, both of which are locally compact abelian groups.
Lebesgue measure $\lambda$ on $\mathcal B(\mathbb R)$ is the unique measure for which $\lambda(a, b) = b – a$ for all open intervals $(a, b)$. It can be easily seen that $\lambda$ is also translation invariant: If $A \in \mathcal B(\mathbb R)$ and $x \in \mathbb R$, then $\lambda(x + A) = \lambda(A)$. It turns out that translation invariance is almost enough to completely characterize $\lambda$. Indeed, the only translation invariant measure for which $\lambda(0,1) = 1$ is Lebesgue measure.
This can be generalized to other locally compact abelian groups. Suppose $(G, +)$ with Borel $\sigma$-algebra $\mathcal B(G)$, and suppose $K \in \mathcal B(G)$ is a compact set containing an open set. Then there is a unique translation invariant measure $\lambda_G$ such that $\lambda_G(K) = 1$. This measure is called the Haar measure on $G$ normalized on $K$. When $G$ is in fact compact itself, it is natural to take $K=G$ in which case $\lambda_G$ becomes a probability measure on $(G, \mathcal B(G))$.
Exercise: Show that Haar measure on $\mathbb R^N$ is equal to the product measure $\lambda^N$ of Lebesgue measure $\lambda$ on $\mathbb R$.
Lebesgue Measure and Riemann Integrals
Suppose $f$ is a Riemann integrable function supported on the interval $(a, b]$. Then, given a partition $a = a_0 < a_1 < \ldots < a_N = b$, we may make the lower Riemann approximation to $f$ by setting $$f_{\mathbf a} = \sum_{n=1}^N \inf\{f(y) : y \in (a_{n-1}, a_n]\} \boldsymbol 1_{(a_{n-1}, a_n]}.$$ The associated Riemann sum is then $$R_{\mathbf a}(f) = \sum_{n=1}^N \inf\{f(y) : y \in (a_{n-1}, a_n]\} (a_n – a_{n-1}).$$
If $(\mathbf a_n)$ is a sequence of refined partitions, such that $$R_{\mathbf a_n}(f) \rightarrow \int_a^b f(x) \, dx$$ then $f_{\mathbf a_n}$ is a sequence of measurable simple functions which increase to $f$, and $$\int f d\lambda = \lim \int f_{\mathbf a_n} d\lambda = \lim R_{\mathbf a_n}(f) = \int_a^b f(x) \, dx.$$ We have essentially proved the following theorem.
Theorem: If $f$ is a Riemann integrable function on $\mathbb R$, then $f$ is Borel measurable and $$\int f d\lambda = \int_{\mathbb R} f(x) \, dx.$$ Moreover, if $g : \mathbb R^M \rightarrow \mathbb R$ is Riemann integrable, then $g$ is Borel measurable and $$\int g \, d\lambda^M = \int_{\mathbb R} \cdots \int_{\mathbb R} g(x_1, \ldots, x_M) \, dx_1 \cdots dx_M.$$