Let $(S_n)$ be an arbitrary random walk. Define $$M_n:= \max(0,S_1,...,S_n)$$ and $$S_n^{+} := \max\{0,S_n\}.$$
Spitzer's identity states that for $0<r<1$, we have
$$\sum_{n=0}^{\infty} r^n E(e^{itM_n}) = \exp \left( \sum_{n=1}^{\infty} \frac{r^n}{n} E(e^{itS_n^{+}}) \right) .$$
By differentiating I am supposed to show that
$$E(M_n) = \sum_{k=1}^n \frac{1}{k} E(S_k^{+}). $$
However, differentiating with respect to $t$ and putting $t=0$ gives me
$$(1-r)\sum_{n=0}^{\infty} r^n E(M_n) = \sum_{n=1}^{\infty} \frac{r^n}{n} E(S_n^{+}).$$
I cannot see how to get the required result from this.
Many thanks for your help.
Denote $a_n:=\mathbb E[M_n]$ and $b_n:=\mathbb E[S_n^+ ]/n$. The LHS is $$\sum_{n=0}^\infty r^na_n-\sum_{n=1}^\infty r^na_{n-1}=a_0+\sum_{n=1}^\infty r^n(a_n-a_{n-1}).$$ By identification of the coefficients of power series, we derive that for each $n\geqslant 1$, $$a_n-a_{n-1}=b_n,\quad a_0=0, $$ from which the wanted formula follows.