$E[X+Y] = E[X] + E[Y]$ $E\left[\sum_i X_i\right] = \sum_iE[X_i]$
proof
$E[X + Y] = \sum_x\sum_y (x + y) P(X=x, Y=y)$ ... Definition of expected value
$= \sum_x\sum_y x P(X=x, Y=y) + \sum_x\sum_y y P(X=x, Y=y)$ ... Change the order of addition
$= \sum_x x \sum_y P(X=x, Y=y) + \sum_y y \sum_x P(X=x, Y=y)$ ... Constant bracketing
$= \sum_x x P(X=x) + \sum_y y P(Y=y)$ ... marginalization
$= E[X] + E[Y]$ ... Definition of expected value
$#{x\in X | f(x) } = \sum_{x\in X} [f(x)]$
$E_Y\left[\sum_{x\in X} [f(x, y)] \right] = \sum_{y\in Y}\sum_{x\in X} [f(x, y)]p(Y=y) = \sum_{x\in X} E_Yf(x, y)$
This is not peripheral...
This page is auto-translated from /nishio/和の期待値は期待値の和 using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.