For finite sets, it's easy to derive this formula by induction.
Let $n_k$ denote the sum of the cardinalities of all the subsets of a $k$-element set. Clearly, $n_0 = 0$, since the only subset of an empty set is empty.
Now, let $S$ be a $k-1$ element set, and consider what happens when we add one more element $x$ to $S$ to obtain the $k$ -element set $S' = S \cup \{x\}$.
Clearly, the subsets of $S'$ can be divided into two groups of equal size: those that contain $x$, and those that don't.
The subsets of $S'$ that do not contain $x$ are exactly the subsets of $S$, and so the sum of their cardinalities is $n_{k-1}$.
The subsets of $S$ that do contain $x$, meanwhile, can be mapped one-to-one onto those that don't, simply by removing $x$ from them, with each subset containing exactly one more element (namely $x$) more than the corresponding $x$-less subset.
Thus, the sum of their cardinalities equals $n_{k-1} + m_k$, where $m_k = |P(S)| = 2^{k-1}$ is the number of subsets of $S$ (and thus also the number of subsets of $S'$ that contain $x$).
Thus, the total sum of the cardinalities of the subsets of $S'$ is $n_k = 2n_{k-1} + 2^{k-1}$. Noting that:
\begin{eqnarray}
n_1 &=& 2 n_0 + 2^0 &=& 0 + 1 &=& 1 &=& 1 \cdot 2^0, \\
n_2 &=& 2 n_1 + 2^1 &=& 2 + 2 &=& 4 &=& 2 \cdot 2^1, \\
n_3 &=& 2 n_2 + 2^2 &=& 8 + 4 &=& 12 &=& 3 \cdot 2^2, \\
n_4 &=& 2 n_3 + 2^3 &=& 24 + 8 &=& 32 &=& 4 \cdot 2^3, \\
n_5 &=& 2 n_4 + 2^4 &=& 64 + 16 &=& 80 &=& 5 \cdot 2^4, \\
\end{eqnarray}
we may observe a pattern, and guess that a closed-form solution would be $n_k = k \, 2^{k-1}$.
We can then easily verify that this guess indeed satisfies the recurrence we derived above: if $n_{k-1} = (k-1)2^{k-2}$, then $n_k = 2(k-1)2^{k-2} + 2^{k-1} = k \, 2^{k-1}$.