Expected value of a realization of a random variable rather than of a random variable itself In the deeplearningbook.org, they sometimes write the expected value of a realization of a random variable, e.g.,:
$\mathbb{E}(x^{(i)})$
Strictly speaking, $x^{(i)}$ is a realization of a random variable $\textbf{x}$ and this does not make any sense to me to write the expected value w.r.t. a realization because the expected value is to be taken with respect to a random variable. I do not see what it means with respect to a realization of a R.V.? Is it some kind of abuse of notations?
Anyway this is absolutely not clear to me. Please, also refer to the screenshot dor an example where this expectation is replaced with an expected value w.r.t. all the values  (in this exaple 0 and 1) of a random variable $\textbf{x}$
It happends at eq. 5.25 and i see that they want to use the linearity of expectation but what does it mean to write the expected value w.r.t. a realization  exactly?

 A: They are indeed mixing notation.  Consider equations (5.25) and (5.26) which use $x^i$ both as a random variable and a dummy variable to a summation!
Here is how I would rewrite the "Example:Bernoulli distribution" (5.21)-(5.28):

Modified Example for Bernoulli distribution: Consider a sequence of i.i.d. random variables $\{X_i\}_{i=1}^{\infty}$ that have a Bernoulli distribution with some unknown parameter $\theta \in [0,1]$:
$$ P[X_i=1] = \theta, \quad P[X_i=0] = 1-\theta \quad \forall i \in \{1, 2, 3, ...\}$$
The random variables are often called "samples from the Bernoulli distribution," or simply "samples." Observe that
$$E[X_i]= 0\cdot P[X_i=0]+1\cdot P[X_i=1]=\theta \quad \forall i \in \{1, 2, 3, ...\}$$
A common estimator for $\theta$ is the sample mean: For each positive integer $m$ define the following random variable:
$$ \hat{\theta}_m = \frac{1}{m}\sum_{i=1}^m X_i$$
To show this estimator is unbiased, we have
\begin{align}
E\left[\hat{\theta}_m\right] &= E\left[\frac{1}{m}\sum_{i=1}^m X_i\right]\\
&=\frac{1}{m}\sum_{i=1}^m E[X_i] \\
&=\frac{1}{m}\sum_{i=1}^m \theta\\
&=\theta
\end{align}

On "realizations": Recall that the random variables $X_i$ are mappings from the sample space $\Omega$ to the set of real numbers: $X_i:\Omega\rightarrow\mathbb{R}$. If we draw a particular outcome $\omega \in \Omega$ then we get a particular sequence of realizations:
$$ X_1(\omega), X_2(\omega), X_3(\omega), ...$$
The outcome $\omega$ determines the value of each term of the infinite sequence $\{X_i(\omega)\}_{i=1}^{\infty}$.
For example we might run the probability experiment by selecting a particular outcome $\omega_a \in \Omega$ to get the following realizations for the first 4 samples:
$$ (X_1(\omega_a), X_2(\omega_a), X_3(\omega_a), X_4(\omega_a)) = (0, 0, 1, 0)$$
and so $\hat{\theta}_4(\omega_a) = (0+0+1+0)/4 = 1/4$.
We might re-run the probability experiment by selecting a new outcome $\omega_b \in \Omega$ to get new realizations:
$$ (X_1(\omega_b), X_2(\omega_b), X_3(\omega_b), X_4(\omega_b)) = (1, 0, 0, 1)$$
and so $\hat{\theta}_4(\omega_b) = (1+0+0+1)=1/2$.
For the probability masses we have
\begin{align}
&P[(X_1, X_2, X_3, X_4) = (0,0,1,0)] = \theta(1-\theta)^3\\
&P[(X_1, X_2, X_3, X_4) = (1,0,0,1)] = \theta^2(1-\theta)^2
\end{align}
Often it is convenient to use $(x_1, x_2, x_3, x_4) \in \{0,1\}^4$ to
represent a particular realization of the 16 possible ones, then
\begin{align}
P[(X_1, X_2, X_3, X_4) = (x_1,x_2,x_3,x_4)] &= \prod_{i=1}^4P[X_i=x_i]\\
&=\prod_{i=1}^4\theta^{x_i}(1-\theta)^{1-x_i} \\
&= \theta^{x_1+x_2+x_3+x_4}(1-\theta)^{4-x_1-x_2-x_3-x_4}
\end{align}
