Let $\omega\in (0,1]$ be represented in binary as $\omega=0.d_1(\omega)d_2(\omega)\cdots$ where each $d_i(\omega)$ is either $0$ or $1$ (a tail of zeros is prohibited). We define $r_n(\omega)=2d_n(\omega)-1$ and $s_n(\omega)=\sum_{i=1}^n r_i(\omega)$.
We may use $(r_n)$ to model a simple random walk: Pick a $\omega\in(0,1]$. There is a particle initially at the origin. At the $i$th stage, where $i=1,2,3,\cdots$ the particle moves a unit to the right or left depending on whether $r_i(\omega)$ is $1$ or $-1$ respectively. Clearly, $s_n(\omega)$ represents the position of the particle after $n$ steps.
It is proved in my book that $\int_0^{1}s_n(\omega)d\omega=0$. I understand that proof. After that there is a line:
If the integral is viewed as an expected value, then $\int_0^1s_n(\omega)d\omega=0$ says that the mean position after $n$ steps of a random walk is $0$.
I don't understand this line. I interpret $s_n$ as a sum of $n$ independent RVs which have identical two-point uniform distributions. As such $s_n$ is discrete and its expected value should be given by a summation. The book has not mentioned either random variables or expected value till this point. Can someone explain this line?
Let's consider the case where $X$ is a discrete random variable, eg. it takes its values in $\{1,\ldots,n\}$. There are in general two ways to express the expectation of a random variable of the form $f(X)$, where is $f$ a (deterministic) function, say from $\{1,\ldots,n\}$ to $\{1,\ldots,m\}$:
(1) $\mathbf{E} f(X)=\sum_{y=1}^m y \mathbf{P}[f(X)=y]$
(2) $\mathbf{E} f(X)=\sum_{x=1}^n f(x) \mathbf{P}[X=x]$
(1) is basically the definition of the expectation of a random variable (applied to $f(X)$). (2) follows from (1) by an easy theorem that we sometimes call transfert formula (it's so easy that we usually don't mention it).
Now in your case, the variable $X$ is called $\omega$ and it's a continuous random variable. The formula (1) still makes sense:
$$\mathbf{E} s_n(\omega)=\sum_{i=-n}^n i \mathbf{P}[s_n(\omega)=i]$$
However, to write (2), you now need an integral because the underlying measure is not discrete anymore:
$$\mathbf{E} s_n(\omega)=\int_{0}^1 s_n(t) \,dt$$