The expression
$$\sum_{r = 0}^{n} (-1)^r\binom{n}{r}(n - r)^k$$
counts the number of surjective functions $f: \{1, 2, 3, \ldots, k\} \to \{1, 2, 3, \ldots, n\}$. To see this, observe that there are $n^k$ functions $f: \{1, 2, 3, \ldots, k\} \to \{1, 2, 3, \ldots, n\}$ since there are $n$ possible images in the codomain for each of the $k$ elements in the domain. To ensure that the function is surjective, we must exclude those functions that exclude one or more elements of the codomain from the range. There are $\binom{n}{r}$ ways to exclude $r$ elements of the codomain from the range and $(n - r)^k$ ways to map the $k$ elements of the domain to the remaining $n - r$ elements of the codomain. Applying the Inclusion-Exclusion Principle yields the expression above.
If $k < n$, then at most $k < n$ elements can be in the range, so there are no surjective functions $f: \{1, 2, 3, \ldots, k\} \to \{1, 2, 3, \ldots, n\}$. If $k = n$, then a surjective function $f: \{1, 2, 3, \ldots, n\} \to \{1, 2, 3, \ldots, n\}$ is a permutation of the set $\{1, 2, 3, \ldots, n\}$, of which there are $n!$. Thus,
$$\sum_{r = 0}^{n} (-1)^r\binom{n}{r}(n - r)^k = \begin{cases}
0 & \text{if $k < n$}\\
n! & \text{if $k = n$}
\end{cases}$$