This is a lemma that I know as "Transfer Lemma" in Integration Theory or in Probability theory. Although I state it in general form, this lemma seems to be essential when studying conditional expectations formally.
Let $(\mathcal{X}, \mathcal{F}, \mu)$ be a measure space and $(\mathcal{Y},\mathcal{B})$ be a measurable space. $f: (\mathcal{X}, \mathcal{F}, \mu) \to (\mathcal{Y},\mathcal{B})$ is a measurable map. Let $f_* \mu (A):= \mu(\{ f^{-1}(A)\})$ for $A \in \mathcal{B}$ be a pushed forward measure. Let $\phi: (\mathcal{Y},\mathcal{B}) \to (\mathbb{R}, \mathcal{B}(\mathbb{R}))$ be measurable. Then, the following hold.
(1) If $\phi$ is non-negative, then $\phi \circ f$ is also non-negative, and $\int_\mathcal{X} \phi \circ f d \mu= \int_\mathcal{Y} \phi d (f_* \mu)$
(2) $\phi$ is integrable with respect to $f_* \mu \iff$ $\phi \circ f$ is integrable with respect to $\mu$, and in this case $\int_\mathcal{X} \phi \circ f d \mu= \int_\mathcal{Y} \phi d (f_* \mu)$.
Question: I know that the above holds, but does $\int_\mathcal{X} \phi \circ f d \mu= \int_\mathcal{Y} \phi d (f_* \mu)$ also hold for all measurable $\phi$? It seems that it does, but I am unable to come up with a proof. Would anyone have a nice proof to this? (Please consider writing it out in detail; I get easily confused if the answers are too compact!)
Theorem: A measurable function $g$ on $X_2$ is integrable with respect to the pushforward measure $f_*(μ)$ if and only if the composition $g \circ f$ is integrable with respect to the measure $μ$. In that case, the integrals coincide, i.e.,
$$\int_{X_2} g \, d(f_* \mu) = \int_{X_1} g \circ f \, d\mu$$
So if one of the function $g$ or $g \circ f$ is integrable (with respect to the corresponding measure), then by the above the other function is integrable as well, and the equality holds.
Edit: The question arises, wether the equality also holds in the case, when
The answer is affirmative. We will consider this in the following:
Recall the definition of the integral of a real valued function $f$. Denote the positive and negative parts of $f$ with $f^+$ and $f^-$. If at least one of $\int f^+$ and $\int f^-$ is finite, we define $$\int f = \int f^+ - \int f^-$$ (If $\int f^+$ and $\int f^-$ are both finite, we say that $f$ is integrable.)
In the following we denote the push forward measure with $\nu\equiv f_* \mu$. By assumption 1), the following integrals exist
$$ \int_{X_2} g \, d\nu = \int_{X_2} g^+ \, d\nu - \int_{X_2} g^- \, d\nu =G^+ -G^-$$
$$ \int_{X_1} g \circ f \, d\mu = \int_{X_1} g^+ \circ f \, d\mu - \int_{X_1} g^- \circ f \, d\mu =F^+ - F^-$$
(where we used that $(g \circ f)^+=g^+ \circ f$), which means that at least one of $G^+$ and $G^-$ is finite. Assumtion 2) means that at least one of $G^+$ and $G^-$ is infinite. This means that exactly one of $G^+$ and $G^-$ is finite and the other one is infinite. By similar argument the same is true for $F^+$ and $F^-$. It is easy to see that $G^+$ and $F^+$ are finite or infinite simultaneously. (Indeed, assume that $G^+$ is finite, then by Theorem it follows, that $F^+$ is finite as well.) Thus RHS and LHS are plus infinite or minus infinite in the same time. This completes the proof.