One common way to deal with this is using generating function.
In this problem, the key is to generate the $k^2$ factor in the sum.
Notice if you have a polynomial $P(z) = \sum_{k=0}^n a_k z^k$ in $z$, everytime
you apply the operator $z\frac{d}{dz}$ to it, the $z^k$ term will pick up an extra factor $k$. More precisely, you will have
$$\left(z\frac{d}{dz}\right)^m P(z) = \sum_{k=0}^n a_k k^m z^k$$
With these in mind, one find
$$\begin{align}
\sum_{k=0}^n \binom{n}{k} k^2 z^k = &
\sum_{k=0}^n \binom{n}{k} \left(z\frac{d}{dz}\right)^2 z^k =
\left(z\frac{d}{dz}\right)^2 \sum_{k=0}^n \binom{n}{k} z^k\\
= & \left(z\frac{d}{dz}\right)^2 (1+z)^n
= z\frac{d}{dz} nz(1+z)^{n-1}\\
= & z \left( n(1+z)^{n-1} + n(n-1)z(1+z)^{n-2}\right)
\end{align}$$
Taking $z = 1$ on both sides, one get
$$\sum_{k=0}^n \binom{n}{k} k^2 = n 2^{n-1} + n(n-1) 2^{n-2} = (n^2 + n) 2^{n-2}$$