combinatorics: sum of product of integer compositions I am trying to solve a problem from Stanley's book, it says:
Fix $k,n \in \mathbb{P}$. Show that:
\begin{align}
\sum a_1 a_2 \cdots a_k = \binom{n+k-1}{2k-1}
\end{align}
where the sum ranges over all compositions $(a_1 , a_2 , \ldots , a_k)$ of $n$ into $k$ parts.
I am trying to reason like this:
we need to find the coefficient $c_n = \sum a_1 a_2 \cdots a_k$ from this generating function --
\begin{align}
\sum_n c_n x^n &= \sum_n \sum a_1 a_2 \cdots a_k x^n \\ 
&= \sum_n \sum a_1 a_2 \cdots a_k x^{a_1 + a_2 + \cdots + a_k}\\
&= \sum_n \sum a_1x^{a_1} a_2x^{a_2} \cdots a_kx^{a_k}
\end{align}
after that, I have no clue, how do I solve this ? 
moreover, what is the range in the inner sum ?

If we consider Mark Riedel's answer, and assume $n=4$, $k=2$; then the sum will be 
\begin{align}
\sum (z + 2z^2)^2 = z^2 + 4z^3 + 4z^4
\end{align}
On the other hand the compositions will be $(1,3), (2,2), (3,1)$, therefore the above sum will be counted as:
\begin{align}
(1.3)z^{1+3} + (2.2)z^{2+2} + (3.1)z^{3+1} &= 1z^1.3z^3 + 2z^2.2z^2 + 3z^3.1z^1\\ 
&= 3z^4 + 4z^4 + 3z^4 = 10z^4
\end{align} 
what's going on? what am I missing?

This is  a supplement to @MarkoRiedel's answer which should clarify OPs question. At first we look at the compositions of $n=4$ which consists of two terms ($k=2$) and look at the corresponding terms of the generating function.

\begin{array}{crl}
1+3\qquad&\qquad  x^1\cdot3x^3=&3x^4\\
2+2\qquad&\qquad2 x^2\cdot 2 x^2=&4x^4\\
1+3\qquad&\qquad3 x^3\cdot x^1=&3x^4\\
\end{array}

When looking at the three compositions above, we see the first summand is either $1$ or $2$ while the second summand is either $3$ or $2$. In general the first summand is a positive integer encoded as generating function
\begin{align*}
(x^1+2x^2+3x^3+\cdots)=\sum_{n=1}^\infty  n x^n=x\frac{d}{dx}\left(\frac{1}{1-x}\right)=\frac{x}{(1-x)^2}
\end{align*}
The same holds for all the other summands of a composition. Since we want to multiply the summands and $k=2$  we have to consider
\begin{align*}
(x^1+2x^2+3x^3+\cdots)^2=\frac{x^2}{(1-x)^4}\tag{1}
\end{align*}
We use the coefficient of operator $[x^n]$ to denote the coefficient of $x^n$.

The number of  compositions of $n=4$ is according to (1)
  \begin{align*}
[x^4](x^1+2x^2+3x^3+\cdots)^2&=[x^4](x^1+2x^2+3x^3)^2\tag{2}\\
&=([x^3]+2[x^2]+3[x^1])(x^1+2x^2+3x^3)\tag{3}\\
&=3+2\cdot 2+3\\
&=\color{blue}{10}
\end{align*}

Comment:


*

*In (2) we see it is sufficient to consider terms with exponents up to $3$, since higher exponents do not contribute to $x^4$.

*In (3) we use the linearity of the coefficient of operator and apply the rule $$[x^p]x^qA(x)=[x^{p-q}]A(x)$$

On the other hand we obtain with $n=4$ and $k=2$
  \begin{align*}
\binom{n+k-1}{2k-1}=\binom{5}{3}=\color{blue}{10}
\end{align*}

