Probability generating function of some "random walk" 
Let $S_n=\sum^n_{r=0}X_r$ be a left-continuous random walk on the integers 
  with a retaining barrier at zero. More specifically, we assume that
  the $X_r$ are identically distributed integer-valued random variables
  with $X_1\geq -1, \mathbb{P}(X_1=0)\neq 0$, and 
$$ S_{n+1} =  \left\{ \begin{matrix} S_n+X_{n+1},\mbox{  if  }
> S_n>0,\\ S_n+X_{n+1}+1,\mbox{  if  } S_n=0. \end{matrix} \right.$$
Show that the distribution of $S_0$ may be chosen in such a way that
  $\mathbb{E}(z^{S_n})=\mathbb{E}(z^{S_0})$ for all $n$, if and only if
  $\mathbb{E}(X_1)<0$, and in this case
$$\mathbb{E}(z^{S_n})=\dfrac{(1-z)\mathbb{E}(X_1)\mathbb{E}(z^{X_1})}{1-\mathbb{E}(z^{X_1})}$$

Attempt
I want to prove the "=>" part:
The probability generating function for $S_n$ and $X_n$ are
$$ \mathbb{E}(z^{S_n}) = \sum^{+\infty}_{i=0} z^i \mathbb{P}(S_n=i)$$
$$ \mathbb{E}(z^{X_1}) = \sum^{+\infty}_{i=-1} z^i \mathbb{P}(X_n=i)$$
We have
\begin{align}
P(S_n=i) &= \sum_{k=1}^{i+1} P(S_n=k)P(X_{n+1}=i-k) + P(S_n=0)P(X_{n+1}=i-1)\\
&= \sum_{k=1}^{i+1} P(S_0=k)P(X_{1}=i-k) + P(S_0=0)P(X_{1}=i-1)\\
&= \sum_{k=0}^{i+1} P(S_0=k)P(X_{1}=i-k) + P(S_0=0)P(X_{1}=i-1) - P(S_0=0)P(X_1=i)\\
\end{align}
for all $i\geq 0$.
Multiply both sides by $z^i$, we have
$$z^i P(S_n=i) = \sum_{k=0}^{i+1} z^k P(S_0=k)z^{i-k}P(X_{1}=i-k) + zP(S_0=0)z^{i-1}P(X_{1}=i-1) - P(S_0=0)z^iP(X_1=i)
$$
Sum both sides over $i\geq 0$, we have
$$
\mathbb{E}(z^{S_0}) = \mathbb{E}(z^{S_0})\mathbb{E}(z^{X_1}) + zP(S_0=0)\mathbb{E}(z^{X_1}) - P(S_0=0)\left(\mathbb{E}(z^{X_1})-\frac{P(X_1=-1)}{z}\right)
$$
Finally we get
$$
\mathbb{E}(z^{S_0}) = \dfrac{\mathbb{E}(z^{X_1})P(S_0=0)(z-1)+P(S_0=0)P(X_1=-1)/z}{1-\mathbb{E}(z^{X_1})}
$$
What's the problem here?
 A: For simplicity, I will write $q_k$ for $P(S=k)$ and $p_k$ for $P(X=k)$
while dropping the subscripts on $S_0$ and $X_1$.
Your double summation is not quite correct; when you exchange the order 
of summation the lower bound should be $i=(k-1)_+$, not $i=k-1$.
This is because $i$ can never be negative. Of course, this only makes 
a difference when $k=0$.
The correct simplification  for the double summation  is
$$\sum_{i=0}^\infty \sum_{k=0}^{i+1}z^k q_k  z^{i-k} p_{i-k}=
\sum_{k=0}^\infty z^k q_k \sum_{i=(k-1)_+}^\infty z^{i-k} p_{i-k}=
\mathbb{E}(z^S)\mathbb{E}(z^X)-q_0p_{-1}/z.$$
Plugging this into your otherwise correct expression gives
\begin{eqnarray*}
\mathbb{E}(z^{S}) &=&
 \left[\mathbb{E}(z^{S})\mathbb{E}(z^{X})-q_0p_{-1}/z\right] + z q_0 \mathbb{E}(z^{X}) 
- q_0 \left(\mathbb{E}(z^{X})-p_{-1}/z\right)\\[8pt]
&=&
 \mathbb{E}(z^{S})\mathbb{E}(z^{X}) + (z-1)q_0\mathbb{E}(z^{X}) 
\end{eqnarray*}
which leads to
$$\mathbb{E}(z^{S})={(z-1) q_0 \mathbb{E}(z^{X}) \over 1-\mathbb{E}(z^X)}, $$ the same as the given solution. 
It is a nice exercise to show that, in this problem, we have
$q_0=-\mathbb{E}(X)$.
