Let $X,Y$ be two random variables and consider $E[g(Y)\mid X]$. Suppose $\cup_{i=1}^N A_i= \mathbb{R}$, then do we have some thing like
$$E[g(Y)\mid X]=\sum_i E[g(Y)\mid 1_{Y\in A_i}, X]P[\{Y\in A_i\}\mid X].$$
Basically, I am trying to compute the conditional expectation of $g(Y)$ by separating it with different cases based on the value of $Y$.
I get the idea from the following equality, suppose $\cup_i A_i=A$, then $$P(Y\in A\mid X\in B)=\sum_i P(Y\in A\mid Y\in A_i, X\in B)P(Y\in A_i\mid X\in B).$$
I know the law of total expectation but I don't know whether it can be used here.