Expectation under a different measure Suppose that $X$ and $Y$ are random variables and $E[X]=0$ under $p(x)$. Is it possible to say that $E[X]=0$ under $p(x\mid y)$? In the discrete setting we have
$$\sum_{i=1} x_{i}p(x_{i}\mid y) = \frac{p(y\mid x)}{p(y)}\sum_{i=1} x_{i}p(x_{i})=0$$ I am not sure that I can factor out $p(y\mid x)$ or I should keep it under the sum as $p(y\mid x_{i})$. But again, $p(y|x)$ is a function of $y$. Can anyone elucidate.

$p_{Y\mid X}(y\mid x_i)$ is a conditional function of $y$, when given $X=x_i$.   As such, $p(y\mid x_i)$ can not be factored out of the series; because it is not relatively constant wrt $i$.   However, doing so with $p(y)^{-1}$ is okay. $$\begin{align}\mathsf E(X\mid Y=y)~&=~ \sum_{i}x_i\,p(x_i\mid y) \\[1ex]&=~ p(y)^{-1}\sum_i x_i\,p(y\mid x_i)\,p(x_i)\\[1ex]&=~ p(y)^{-1}\sum_i x_i\,\mathsf E(\mathbf 1_{Y=y}\mid X=x_i)\,p(x_i)\\[2ex]&=~\dfrac{\mathsf E(X\cdot\mathbf 1_{Y=y})}{p(y)}\end{align}$$
Also, no, $\mathsf E(X)=0$ does not necessarily mean $\mathsf E(X\mid Y=y)=0$
Counter example, Let $X\sim\mathcal U[-1;1]$ and $Y=-X$, then $\mathsf E(X)=0$ but clearly $\mathsf E(X\mid Y=y)=-y\cdot\mathbf 1_{ y\in[-1;1]}$.

Where $\mathbf 1_{Y=y}$ is the indicator random variable, $\begin{cases}1&:&Y=y\\0&:& Y\neq y\end{cases}$ .
Similarly $\mathbf 1_{y\in[-1;1]}=\begin{cases}1&:&y\in[-1;1]\\0&:& \text{otherwise}\end{cases}$
