Show that for any flow $f$ in a netowrk $N$ with vertice set $V$, arc set $A$, and source and sink sets $X,Y$ respectively that for any $S \subset V$,
$\sum_{v \in S}(f^{out}(v) - f^{in}(v)) = f^{out}(S) - f^{in}(S)$.
Clearly by the definition of a flow if $v \notin X \cup Y$ then $f^{out}(v) - f^{in}(v) = 0$, so this amounts to proving $\sum_{v \in S \cap ( X \cup Y)}(f^{out}(v) - f^{in}(v))=f^{out}(S) - f^{in}(S)$ but I am not sure how to proceed.
Hint: We can write: $$\begin{align*} \sum_{v \in S \cap (X \cup Y)} (f^{out}(v)−f^{in}(v)) & = \sum_{v \in (S \cap X) \cup (S \cap Y)} (f^{out}(v)−f^{in}(v)) \\ & = \sum_{v \in S \cap X} (f^{out}(v)−f^{in}(v)) + \sum_{v \in S \cap Y} (f^{out}(v)−f^{in}(v)) \\ \end{align*}$$ The second equality comes from the fact that we can "separate" the cases where $v \in S \cap X$ and $v \in S \cap Y$, since these are disjoint sets. You can now use facts about $X$ and $Y$, along with the observation about vertices $v \notin X \cup Y$, to reduce this expression to the equality you want.