Let \(X\) be the random variable chosen uniformly from \(\{1,2,\ldots, n\}\). Then
\[E(X^k) = \sum_{x=1}^n \frac{x^k}{n}.\]
Alternatively, by the
tail-sum formula,
\[E(X^k)=\sum_{x=0}^{n^k} P(X^k>x) = \sum_{x=0}^{n^k} P\left(X>\lfloor x^{1/k}\rfloor\right)= \sum_{x=0}^{n^k} \frac{n-\lfloor x^{1/k}\rfloor}{n}.\] Setting these quantities equal, multiplying both by \(n\), and rearranging gives the desired equality.