<s>[INST] How to compute the  formula $\sum  \limits_{r=1}^d r \cdot 2^r$? Given $$1\cdot 2^1 + 2\cdot 2^2 + 3\cdot 2^3 + 4\cdot 2^4 + \cdots + d \cdot 2^d = \sum_{r=1}^d r \cdot 2^r,$$
how can we infer to the following solution? $$2 (d-1) \cdot 2^d + 2. $$
Thank you
 [/INST] Summation by parts gives that with the choice $a_k=2^k, b_k=k$ we have
$$ A_k = 2^1+\ldots+2^k = 2^{k+1}-2 $$ and
$$ \sum_{k=1}^{n}a_k b_k = A_n b_n - \sum_{k=1}^{n-1} A_k $$
so:
$$ \sum_{k=1}^{n} k 2^k = (2^{n+1}-2)n-\sum_{k=1}^{n-1}(2^{k+1}-2) = (2^{n+1}-2)n+2(n-1)-2(2^n-2)$$
and the RHS simplifies to $(n-1) 2^{n+1}+2$ as wanted.
</s>