<s>[INST] How to prove $\sum_{n=0}^{\infty} \frac{n^2}{2^n} = 6$? I'd like to find out why
\begin{align}
\sum_{n=0}^{\infty} \frac{n^2}{2^n} = 6
\end{align}
I tried to rewrite it into a geometric series
\begin{align}
\sum_{n=0}^{\infty} \frac{n^2}{2^n} = \sum_{n=0}^{\infty} \Big(\frac{1}{2}\Big)^nn^2
\end{align}
But I don't know what to do with the $n^2$. 
 [/INST] First observe that the sum converges (by, say, the root test).
We already know that $\displaystyle R := \sum_{n=0}^\infty \frac{1}{2^n} = 2$.
Let $S$ be the given sum.  Then $\displaystyle S = 2S - S = \sum_{n=0}^\infty \frac{2n+1}{2^n}$.
Now use the same trick to compute $\displaystyle T := \sum_{n=0}^\infty \frac{n}{2^n}$:  we have $\displaystyle T = 2T - T = \sum_{n=0}^\infty \frac{1}{2^n} = R = 2$.  Hence $S = 2T + R = 6$.
One can continue like this to compute $\displaystyle X:= \sum_{n=0}^\infty \frac{n^3}{2^n}$.  We have $\displaystyle X = 2X-X = \sum_{n=0}^\infty \frac{3n^2+3n+1}{2^n} = 3S+3T+R = 26$.  Sums with larger powers can be computed in the same way.
</s>