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.
 A: Let $S(t)$ be represented by the series
$$S(t)=\sum_{n=1}^\infty e^{-nt}=\frac{1}{e^{t}-1}$$
$t>0$.
Then, note that we have
$$S''(t)=\sum_{n=1}^\infty n^2e^{-nt}=\frac{e^t(e^t+1)}{(e^t-1)^3}$$
Now, let $t=\log(2)$
A: $$
\begin{align}
\sum_{n=0}^\infty x^n=\frac1{1-x}&\implies\sum_{n=0}^\infty\frac1{2^n}=2\tag{1}\\
\sum_{n=0}^\infty nx^{n-1}=\frac1{(1-x)^2}&\implies\sum_{n=0}^\infty\frac{n}{2^{n-1}}=4\tag{2}\\
\sum_{n=0}^\infty n(n-1)x^{n-2}=\frac2{(1-x)^3}&\implies\sum_{n=0}^\infty\frac{n(n-1)}{2^{n-2}}=16\tag{3}
\end{align}
$$
Adding $\color{#CCC}{x^2=}\frac14$ times $(3)$ to $\color{#CCC}{x=}\frac12$ times $(2)$ gives
$$
\color{#CCC}{\sum_{n=0}^\infty n^2x^n=\frac{x(1+x)}{(1-x)^3}\implies}\sum_{n=0}^\infty\frac{n^2}{2^n}=6\tag{4}
$$
A: Probably easiest to think in terms of power series. Note that
$$
\begin{align*}
\sum_{n=1}^{\infty}n^2x^n&=x\sum_{n=1}^{\infty}n^2x^{n-1}=x\frac{d}{dx}\left[\sum_{n=1}^{\infty}nx^n\right].
\end{align*}
$$
Can you see how to find an explicit functional form for the sum inside the derivative?
A: Suppose $|x|<1$ at the last you put $x=\frac12$
$$s_1=1+x+x^2+x^3+x^4+...=\frac{1}{1-x}$$nw find $s'_1$
$$s'_1=0+1+2x+3x^3+4x^3+5x^4+...+nx^{n-1}+...=(\frac{1}{1-x})'\\1+2x+3x^2+4x^3+...=\frac{1}{(1-x)^2}$$now multiply by $x$
$$S_2=xS'_1=x^1+2x^2+3x^3+4x^4+5x^5+...=\frac{x}{(1-x)^2}$$
now find $S_2'$
$$S'_2=1+2^2x^1+3^2x^2+4^2x^3+5^2x^4+...+(n^2x^{n-1})+...=(\frac{x}{(1-x)^2})'$$finally :multiply by $x$
$$xS'_2=1^2x+2^2x^2+3^2x^3+4^2x^4+...(n^2x^n)+...=x(\frac{x}{(1-x)^2})'\\
\sum_{n=2}^{\infty}n^2x^n=x(\frac{x}{(1-x)^2})'-x$$put $x=\frac12$
$$\sum_{n=2}^{\infty}n^2(\frac{1}{2})^n=\sum_{n=2}^{\infty}\frac{n^2}{2^n}$$
for adjustment $$\sum_{n=2}^{\infty}\frac{n^2}{2^n}=(\sum_{n=1}^{\infty}\frac{n^2}{2^n} )-\frac{1^2}{2^1}$$ you can find $$x(\frac{x}{(1-x)^2})'-x$$ then put $x=\frac12$
A: $$S_0:=\sum_{k=1}^\infty2^{-k}=1.$$
$$S_1:=\sum_{k=1}^\infty 2^{-k}k=\sum_{k=2}^\infty 2^{1-k}(k-1)=2(S_1-S_0)$$ so that
$$S_1=2.$$
Next
$$S_2:=\sum_{k=1}^\infty 2^{-k}k^2=\sum_{k=2}^\infty 2^{1-k}(k^2-2k+1)=2(S_2-2S_1+S_0)$$
and 
$$S_2=6.$$

You can continue systematically, using Pascal's triangle
$$S_3=2(S_3-3S_2+3S_1-S_0)\to S_3=26$$
$$S_4=2(S_4-4S_3+6S_2-4S_1+S_0)\to S_4=150$$$$\cdots$$
$$S_n=2\sum_{j=0}^{n-1}\binom nj(-1)^{n-1-j}S_j$$
A: 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}.
$$
