On a countable space $\Omega$, let $X$ be a real-valued random variable and the expectation of $X$ is $$ E(X)=\sum_\omega X(\omega)P(\{ \omega\}) $$ $L^1$ is the space of real-valued random variables which have a finite expectation. The distribution of $X$ is $$ P^X(A)=P(X^{-1}(A))=P(X\in A) $$
I am trying to understand what it means that if $X\in L^1$, then the expectation depends only on its distribution? I don't really get it.
As you wrote,
$E[X] = \sum X(\omega) P(\{\omega\})$.
This could be written differently as $E[X] = \sum xP(X=x)$.
This makes it easy to see that the expectation is determined by the distribution since $P(X=x) = P(X^{-1}(x))$ .