Let Y be a random variable taking on values in the non-negative integers.
Claim: $E\left(Y\right)=\sum_{n=1}^{\infty}nP\left[Y=n\right]=\sum_{n=1}^{\infty}\sum_{k=1}^{n}P\left[Y=n\right]=\sum_{k=1}^{\infty}\sum_{n=k}^{\infty}P\left[Y=n\right]$
The second equality seems to be a change of dummy index. I do not see how the third equality holds.
Any help is appreciated.
edit:
I tried understanding the above like this, and wondered if it's also valid.
$\sum_{n=1}^{\infty} P\left[Y=n \right ] \sum_{k=1}^{n} \left(1\right) =P\left[1 \right ]\left ( 1 \right )+ \cdot \cdot \cdot $
so we see that the upper bound term $n$ of the sum $\sum_{k=1}^{n}\left(1 \right )$ is dependent on the upper bound term $a$ in$ \lim_{a\rightarrow \infty} \sum_{n=1}^{a} \left ( 1 \right )= \sum_{n=1}^{\infty} \left ( 1 \right )$.
Keeping the above in mind, we have $\sum_{k=1}^{n}\left ( 1 \right )=\lim_{n\rightarrow \infty} \sum_{k=1}^{n}\left ( 1 \right )=\sum_{k=1}^{\infty}\left ( 1 \right )$ to give $\sum_{n=1}^{\infty} \sum_{k=1}^{\infty} P\left[Y=n \right ]$ for the third equality.
Let $[k\leq n]$ denote a function that takes value $1$ if indeed $k\leq n$ and that takes value $0$ otherwise.
Then:
$$\begin{aligned}\sum_{n=1}^{\infty}nP(Y=n) & =\sum_{n=1}^{\infty}\sum_{k=1}^{\infty}[k\leq n]P(Y=n)\\ & =\sum_{k=1}^{\infty}\sum_{n=1}^{\infty}[k\leq n]P\left(Y=n\right)\\ & =\sum_{k=1}^{\infty}\sum_{n=k}^{\infty}P\left(Y=n\right) \end{aligned} $$