Let $\{a_n\}$ be a sequence of real numbers. Let $s_n = a_0+...+a_n$. The following equalities appear in a proof I'm reading
\begin{align} \sum_{n=0}^\infty a_nx^n &= a_0 + \sum_{n=1}^\infty (s_n - s_{n-1})x^n\\ &= (1-x)\sum_{n=0}^\infty s_nx^n \\ &= (1-x)^2 \sum_{n=0}^\infty (s_0+...+s_n)x^n. \end{align}
The first equality is clear and the second two are said to follow from summation by parts. I guess I'm missing something very basic, but I don't see how to get the last two equalities using summation by parts. Could someone explain this, or at least give me a hint?
Writing $c_n=s_n$ and $d_n=x^n$, summation by parts says that (as formal power series) $$\sum_{n=0}^\infty c_n(d_{n+1}-d_n)=-c_0d_0-\sum_{n=1}^\infty (c_n-c_{n-1})d_n.$$ The left side is $$\sum_{n=0}^\infty s_n(x^{n+1}-x^n)=(x-1)\sum_{n=0}^\infty s_nx^n$$ and the right side is $$-a_0-\sum_{n=1}^\infty (s_n-s_{n-1})x^n,$$ so negating both sides gives your second equality.
For the third equality you can do the same thing, just with $c_n=s_0+\dots+s_n$ instead.