<s>[INST] How could I find the partial sum of this function? $$\displaystyle\sum_{k = 0}^{n}\dfrac{k^2}{2^k}$$ 
What are the steps to finding the partial sum formula?
 [/INST] For the time being, let us consider $$S_n=\displaystyle\sum_{k = 0}^{n}{k^2}x^k=\sum_{k = 0}^{n}{k(k-1)}x^k+\sum_{k = 0}^{n}kx^k=x^2\sum_{k = 0}^{n}{k(k-1)}x^{k-2}+x\sum_{k = 0}^{n}kx^{k-1}$$ and now define $$T_n=\sum_{k = 0}^{n}x^{k}$$ So,we have $$S_n=x^2 \frac{dT^2_n}{dx^2}+x\frac{dT_n}{dx}$$ But $$T_n=\frac{x^{n+1}-1}{x-1}$$ so $$\frac{dT_n}{dx}=\frac{n x^{n+1}-(n+1) x^n+1}{(x-1)^2}$$ $$\frac{dT^2_n}{dx^2}=\frac{2 \left(n^2-1\right) x^n-n (n+1) x^{n-1}+(1-n) n x^{n+1}+2}{(x-1)^3}$$ and so $$S_n=\frac{x (x+1)-x^{n+1} \left(n^2 x^2-\left(2 n^2+2 n-1\right)
   x+(n+1)^2\right)}{(1-x)^3}$$ Replace now $x$ by $\frac{1}{2}$ to get the final answer $$S_n=\displaystyle\sum_{k = 0}^{n}\dfrac{k^2}{2^k}=6-2^{-n}(6+4n+n^2)$$
</s>