Let $\delta_i$ be a set of independent Bernoulli variables with $\mathbb{E}(\delta_i)=p$ for all $i=1,\ldots,n$. Let $$X = \sum_{i=1}^n |1-\frac{1}{p}\delta_i|$$.
I get that $$\mathbb{E}(X)=\sum_{k=0}^n\left(k\frac{1-p}{p}+n-k\right)\binom{n}{k}p^k(1-p)^{n-k}$$
am I right?
On the other hand, I'm trying to get a simple formula to $\mathbb{E}(X)$ and I found experimentally that $$\mathbb{E}(X)=2n(1-p)$$.
Why? I would be grateful if there is a proof of this equality
No need to complicate the matter, just use the linearity of expectation:
$$ \begin{align} \mathbb{E}[X] &= \mathbb{E} \left[\sum_{i=1}^n \left|1 - \frac {1} {p}\delta_i\right| \right] \\ &= \sum_{i=1}^n \mathbb{E} \left[\left|1 - \frac {1} {p}\delta_i\right| \right] \\ &= \sum_{i=1}^n \left[\left|1 - \frac {1} {p} \times 1\right|\times p + \left|1 - \frac {1} {p} \times 0\right|\times (1-p)\right] \\ &= \sum_{i=1}^n [(1 - p) + (1-p)] \\ &= 2n(1 - p) \end{align}$$