Conditional expectation and countable unions Let $\{D_i:i \in \mathbb{N}\}$ be a countable partition of $\Omega$, in words this is saying that $\{D_i\}$ are pairwise disjoint and $\Omega = \cup D_i$. Let $\mathcal{D} = \sigma(\{D_i:i \in \mathbb{N} \})$. 
I succeeded in proving that $G \in \mathcal{D}$ iff. $G = \{\cup_{i \in I} D_i: I \subseteq \mathbb{N} \}$. 
Now, let $X \in L^1(P)$. Let $U = \{i \in \mathbb{N}:P(D_i)>0\}$ and I want to prove that:
\begin{equation}
\mathbb{E}[X | \mathcal{D}](\omega) = \sum_{i:i \in U} \frac{\mathbb{E}[\mathbb{1}_{D_i}X]}{P(D_i)}\cdot\mathbb{1}_{D_i}(\omega).
\end{equation} 
For me it is not clear how I have to use the proven information to obtain the equation.
 A: By definition, $\mathbb{E}[ X \mid \mathcal{D}] =: f$ is the function that solves
$$ \int_A f dP = \int_A X dP$$ for any $A \in \mathcal{D}$. There exists only one function with this property, so you only need to verify if 
 $$\int_A \sum_{i \in U } \frac{\mathbb{E}[1_{D_i} X]}{P(D_i)} \cdot 1_{Di}\, dP =  \int_A X dP $$ holds for any $A \in \mathcal{D}$. Lets check: Take $A\in \mathcal{D}$, then there exist $I \subset \mathbb{N}$ with $A = \cup_{i \in I } D_i$, since the integral does not change on zero sets, we have that the integral does not change on the set $B:= \cup_{i \in I \cap U } D_i$. 
$$\begin{align*} \int_A \sum_{i \in U } \frac{\mathbb{E}[1_{D_i} X]}{P(D_i)} \cdot 1_{Di}\, dP &=  \int_B \sum_{i \in U } \frac{\mathbb{E}[1_{D_i} X]}{P(D_i)} \cdot 1_{Di}\, dP  \\ &= \sum_{i \in U }\int_B  \frac{\mathbb{E}[1_{D_i} X]}{P(D_i)} \cdot 1_{Di}\, dP\\ &= \sum_{i \in U \cap I}\int_{D_i} \frac{\mathbb{E}[1_{D_i} X]}{P(D_i)} \cdot 1_{Di}\, dP \\&= \sum_{i \in U \cap I} \mathbb{E}[1_{D_i} X]   \\ &= \int_B X dP  \\ &=\int_A X dP \end{align*}$$
