How to calculate $\sum_{k=1}^n \left(k \sum_{i=0}^{k-1} {n \choose i}\right)$ How do I calculate the following summation?
$$\sum_{k=1}^n \left[k \sum_{i=0}^{k-1} {n \choose i}\right]$$

(Note: I have attempted to incorporate
OP's edit to the problem.)
$\begin{array}\\
\sum_{k=1}^n (k \sum_{i=0}^{k-1} {n \choose i})
&=\sum_{k=1}^n \sum_{i=0}^{k-1} (k {n \choose i})\\
&=\sum_{i=0}^{n-1} \sum_{k=i+1}^n (k {n \choose i})\\
&=\sum_{i=0}^{n-1} {n \choose i}\sum_{k=i+1}^n k \\
&=\sum_{i=0}^{n-1} {n \choose i}\left(\frac{n(n+1)}{2}-\frac{i(i+1)}{2}\right) \\
&=\frac{n(n+1)}{2}\sum_{i=0}^{n-1} {n \choose i}-\sum_{i=0}^{n-1} {n \choose i}\frac{i(i+1)}{2} \\
&= S-T\\
\end{array}
$
$S
=\frac{n(n+1)}{2}\sum_{i=0}^{n-1} {n \choose i}
=\frac{n(n+1)}{2}(\sum_{i=0}^{n} {n \choose i}-{n \choose n})
=\frac{n(n+1)}{2}(2^n-1)
$.
$T = \sum_{i=0}^{n-1} {n \choose i}\frac{i(i+1)}{2}$.
Consider $t_i = {n \choose i}\frac{i(i+1)}{2}$.
$t_0 = 0, t_1=n$.
For $i \ge 1$,
I would like to use the identity
${ n \choose m}{m \choose k}
={n \choose k}{n-k \choose m-k}
$.
$\begin{array}\\
t_i
&={n \choose i}\frac{i(i+1)}{2}\\
&={n \choose i}\left(\frac{i(i-1)}{2}+i\right)\\
&={n \choose i}({i \choose 2}+{i \choose 1})\\
&={n \choose i}{i \choose 2}+{n \choose i}{i \choose 1}\\
&={n \choose 2}{n-2 \choose i-2}+{n \choose 1}{n-1 \choose i-1}\\
\end{array}
$
$\begin{array}\\
T 
&= t_0+t_1+\sum_{i=2}^{n-1} t_i\\
&= n+\sum_{i=2}^{n-1} \left( {n \choose 2}{n-2 \choose i-2}+{n \choose 1}{n-1 \choose i-1}\right)\\
&= n+\sum_{i=2}^{n-1} {n \choose 2}{n-2 \choose i-2}+\sum_{i=2}^{n-1}{n \choose 1}{n-1 \choose i-1}\\
&= n+ {n \choose 2}\sum_{i=2}^{n-1}{n-2 \choose i-2}+{n \choose 1}\sum_{i=2}^{n-1}{n-1 \choose i-1}\\
&= n+ {n \choose 2}\sum_{i=0}^{n-3}{n-2 \choose i}+{n \choose 1}\sum_{i=1}^{n-1}{n-1 \choose i}\\
&= n+ {n \choose 2}\left(\sum_{i=0}^{n-2}{n-2 \choose i}-1\right)+{n \choose 1}\sum_{i=0}^{n-1}{n-1 \choose i}-1\\
&= n+ {n \choose 2}\left(2^{n-2}-1\right)+{n \choose 1}(2^{n-1}-1)\\
&= n+ \frac{n(n+1)}{ 2}\left(2^{n-2}-1\right)+n(2^{n-1}-1)\\
&=  \frac{n(n+1)}{ 2}\left(2^{n-2}-1\right)+n2^{n-1}\\
\end{array}
$
$\begin{array}\\
S-T
&=\frac{n(n+1)}{2}(2^n-1)-\left( \frac{n(n+1)}{ 2}\left(2^{n-2}-1\right)+n2^{n-1}\right)\\
&=2^{n-2}\left(2n(n+1)-\frac{n(n+1)}{ 2} -2n\right) -\frac{n(n+1)}{2}- \frac{n(n+1)}{ 2}\\
&=2^{n-2}\frac{3n(n+1)-4n}{ 2}-n(n+1)\\
&=2^{n-2}\frac{n(3n-1)}{ 2}-n(n+1)\\
\end{array}
$
As usual,
this was done off the top of my head,
so there is a good chance of error,
but it's late and I'm tired,
so I'll stop here.
All corrections will be appreciated.
