Proof of $\sum_{k=0}^n k \text{Pr}(X=k) = \sum^{n-1}_{k=0} \text{Pr}(X>k) -n \text{Pr}(X>n)$ $X$ is a random variable defined in $\mathbb N$. How can I prove that  for all $n\in \mathbb N$?

  
*
  
*$ \text E(X) =\sum_{k=0}^n k \text{Pr}(X=k) = \sum^{n-1}_{k=0} \text{Pr}(X>k)  -n \text{Pr}(X>n)$ 
  
*$\text E(X) =\sum_{k=0}^n k \text{Pr}(X=k)=\sum_{k\ge 0} \text{Pr}(X>k) $
  


For part $a)$, use Thomas' hint. You get
$$
\sum_{i=0}^{n}k(P(X>i-1)-P(X>i)).
$$
This develops as $P(X>0)-P(X>1)+2P(X>1)-2P(X>2)+3P(X>2)-3P(X>3)+\cdots nP(X>n-1)-nP(X>n)$
for part $b)$:
In general, you have
$\mathbb{E}(X)=\sum\limits_{i=1}^\infty P(X\geq i).$
You can show this as follow:
$$
 \sum\limits_{i=1}^\infty P(X\geq i) = \sum\limits_{i=1}^\infty \sum\limits_{j=i}^\infty P(X = j)
$$
Switch the order of summation gives
\begin{align}
 \sum\limits_{i=1}^\infty P(X\geq i)&=\sum\limits_{j=1}^\infty \sum\limits_{i=1}^j P(X = j)\\
                   &=\sum\limits_{j=1}^\infty j\, P(X = j)\\
                   &=\mathbb{E}(X)
\end{align}
$$\sum\limits_{i=0}^{\infty}iP(X=i)=\sum\limits_{i=1}^\infty P(X\geq i)=\sum\limits_{i=0}^{\infty} P(X> i)$$
