Which is the explanation of the identity $\sum_{k=0}^n {n \choose k}k^2 = 2^{n-2}n(n+1)$?
Here is a counting argument for why this identity holds. Suppose you have a population of $n$ people. Out of this group of people, you want to count the number of ways to create a club that has a president and a treasurer (the president and treasurer could be the same person). The club does not need to include all $n$ people.
One way to count the number of ways to create this club is to 1) Sum over the size of the club. 2) Pick the people to be in the club. 3) Pick the president. 4) Pick the treasurer.
So if the club has size $k$, then there are ${n \choose k}$ ways to choose the club and then $k$ choices for the president and $k$ choices for the treasurer. Overall, there are $$ \sum_{k =0}^n {n \choose k} k^2 $$ such ways.
Conversely, we can 1) Choose the president first (out of $n$ people). 2) Choose the treasurer. 3) Pick the remaining members of the club.
There are $n$ ways to pick the president. Now for the treasurer, we either pick (a) the president or (b) one of the $n-1$ other people. If we pick the president as the treasurer, then each of the remaining $n-1$ people are either in the club or not; as a result, there would be $2^{n-1}$ ways to pick these members in this case. Now if we chose a different person as the treasurer, then each of the remaining $n-2$ people are either in the club or not; as a result, there would be $2^{n-2}$ ways to pick these members. Thus, overall there are $$ n \cdot 1 \cdot 2^{n-1} + n \cdot (n-1) \cdot 2^{n-2} = n(n+1)2^{n-2} $$ ways to select the club.
We have: $$(1+x)^n=\sum_0^n \binom nk x^k$$
Differentiate to get: $$n(1+x)^{n-1}=\sum_1^n \binom nk kx^{k-1}$$
Multiply by $x$ to get: $$nx(1+x)^{n-1}=\sum_1^n \binom nk kx^{k}$$
Differentiate again to get $$n(1+x)^{n-1}+n(n-1)x(1+x)^{n-2}=\sum_1^n \binom nk k^2x^{k-1}$$
Now let $x=1$ to get the desired result. (note that the summand vanishes if $k=0$ so you can start the sum at $k=0$ without changing the right hand).