I have read a few times now in some books the following sentence:
"Expectation depends only on its distribution."
I only had the case that $X$ is a real-valued random variable on a countable space Ω. What does this sentence mean and how can one show it?
I would rather rephrase:
If $(\Omega,\mathcal A,P)$ is a measure space where $P$ is a probability measure and $X:\Omega\to\mathbb R$ is a random variable with existing expectation then by definition:$$\mathbb EX=\int X(\omega)P(d\omega)$$The random variable induces a probability measure $P_X$ on measurable space $(\mathbb R,\mathcal B)$ where $\mathcal B$ denotes the $\sigma$-algebra of Borel subsets of $\mathbb R$.
This $P_X$ is prescribed by $B\mapsto P(\{X\in B\})$ and is the distribution of $X$.
It can be shown that: $$\mathbb EX=\int xP_X(dx)$$ where the RHS is completely determined by $P_X$.
In that sense the expectation of $X$ is determined by the distribution of $X$.