Solution 1:

It is equal to $f(x)=\sum_{n \geq 0} n^2 x^n$ evaluated at $x=1/2$. To compute this function of $x$, write $n^2 = (n+1)(n+2)-3(n+1)+1$, so that $f(x)=a(x)+b(x)+c(x)$ with:

$a(x)= \sum_{n \geq 0} (n+1)(n+2) x^n = \frac{d^2}{dx^2} \left( \sum_{n \geq 0} x^n\right) = \frac{2}{(1-x)^3}$

$b(x)=\sum_{n \geq 0} 3 (n+1) x^n = 3\frac{d}{dx} \left( \sum_{n \geq 0} x^n \right) = \frac{3}{(1-x)^2}$

$c(x)= \sum_{n \geq 0} x^n = \frac{1}{1-x}$

So $f(1/2)=\frac{2}{(1/2)^3}-\frac{3}{(1/2)^2} + \frac{1}{1/2} = 16-12+2=6$.

The "technique" is to add a parameter in the series, to make the multiplication by $n+1$ appear as differentiation.

Solution 2:

For $x$ in a neighborhood of $1$, let $$ f(x) = \sum\limits_{n = 0}^\infty {\frac{{x^n }}{{2^n }}} = \sum\limits_{n = 0}^\infty {\bigg(\frac{x}{2}\bigg)^n } = \frac{1}{{1 - x/2}} = \frac{2}{{2 - x}}. $$ Thus, on the one hand, $$ f'(x) = \sum\limits_{n = 0}^\infty {\frac{{nx^{n - 1} }}{{2^n }}} \;\; {\rm and} \;\; f''(x) = \sum\limits_{n = 0}^\infty {\frac{{n(n - 1)x^{n - 2} }}{{2^n }}} , $$ and, on the other hand, $$ f'(x) = \frac{2}{{(2 - x)^2 }} \;\; {\rm and} \;\; f''(x) = \frac{4}{{(2 - x)^3 }}. $$ Hence, $$ f'(1) = \sum\limits_{n = 0}^\infty {\frac{n}{{2^n }}} = 2 \;\; {\rm and} \;\; f''(1) = \sum\limits_{n = 0}^\infty {\frac{{n(n - 1)}}{{2^n }}} = 4. $$ Finally, $$ \sum\limits_{n = 0}^\infty {\frac{{n^2 }}{{2^n }}} = f'(1) + f''(1) = 6. $$ The idea here was to consider the Probability-generating function of the geometric$(1/2)$ distribution.