How to obtain the sum of the following series? $\sum_{n=1}^\infty{\frac{n^2}{2^n}}$ It seems that I'm missing something about this. 
First of all, the series is convergent: $\lim_{n\rightarrow\infty}\frac{2^{-n-1} (n+1)^2}{2^{-n} n^2}=\frac{1}{2}$ (ratio test)
What I tried to do is to find a limit of a partial sum $\lim_{n\rightarrow\infty}S_n$ as follows: $S_n=\frac{\frac{1}{6} n (n+1) (2 n+1)}{\frac{1-\left(\frac{1}{2}\right)^n}{2 \left(1-\frac{1}{2}\right)}}$. Still, the limit is $\infty$ and I'm clearly doing something wrong.

Note that
$$
n^2=\binom{n+1}{2}+\binom{n}{2}\tag{1}.
$$
Also 
$$
\frac{1}{(1-x)^k}=\sum_{n=0}^\infty \binom{k+n-1}{k-1}x^n\tag{2}.
$$
for $k\geq 1$ (by repeatedly differentiating the geometric series or by the extended binomial theorem). In particular
$$
\frac{1}{(1-x)^3}=\sum_{n=0}^\infty \binom{n+2}{2}x^n\tag{3}.
$$ 
Mutiply by $x^n$ and sum on $n$ in (1) to get that
$$
\sum_{n=0}^\infty n^2x^n
=\sum_{n=0}^\infty\binom{n+1}{2}x^n+\sum_{n=0}^\infty\binom{n}{2}x^n
=\frac{x}{(1-x)^3}+\frac{x^2}{(1-x)^3}
=\frac{x(1+x)}{(1-x)^3}.\tag{4}
$$
by (3). 
Set $x=1/2$ in equation (4) to find that
$$
\sum_{n=0}^\infty \frac{n^2}{2^n}=\color{blue}{6}\tag{5}.
$$
