How to convert expectation to integration $S: \{1,-1\}^n  \rightarrow \{0,1\}$ and $E(S(x))=p$, 
Where $E$ denotes the expectation, and is taken over $x$ , where $x$ is uniformly distributed on $\{-1,1\}^n$.
Then how to prove the following, 
\begin{equation*}
E_x\Bigg[S(x) \sum_{i=1}^n x_i \Bigg] \leq \int_{0}^{\infty}Pr \Big(S(x)\sum_{i=1}^n x_i >y \Big)dy
\end{equation*}

Answer: Using the fact that, for every nonnegative random variable $Y$,
$$
E(Y)=\int_0^\infty P(Y\gt y)\,\mathrm dy=\int_0^\infty P(Y\geqslant y)\,\mathrm dy.
$$
Proof:
$$
Y=\int_0^Y\mathrm dy=\int_0^\infty \mathbf 1_{Y\gt y}\,\mathrm dy=\int_0^\infty \mathbf 1_{Y\geqslant y}\,\mathrm dy.
$$
