I'm reading Harris/Hirst/Mossinghoff's: Combinatorics and Graph Theory.
I don't understand what happens from $\displaystyle \bbox[1px,border:1px solid black]{(1+(x+x^2))^n} $ to $\displaystyle \bbox[1px,border:1px solid black]{\sum_k {n \choose k} (x+x^2)^n} $.

The formula is that: $\displaystyle \sum_{k=0}^n \binom{n}{k}y^k=(1+y)^n$. Now substitute $y = x+x^2$ in the equation.