Let $\kappa$ be infinite and $\mu=\min\{\lambda\mid \kappa^\lambda>\kappa\}$ (this cardinal exists, since already $\kappa^\kappa>\kappa$). If $\mu$ is singular, write $\mu=\sum_{\alpha<\theta}\mu_\alpha$ where $\theta={\rm cf}(\mu)<\mu$ and the $\mu_\alpha$ form a strictly increasing sequence of regular cardinals. We have
$$ \kappa^\mu=\kappa^{\sum_\alpha \mu_\alpha}=\prod_\alpha \kappa^{\mu_\alpha}. $$
Now, by definition of $\mu$, $\kappa^{\mu_\alpha}=\kappa$ for all $\alpha$, and therefore the product above reduces to $\prod_\alpha\kappa=\kappa^\theta$. Again, since $\theta<\mu$, then $\kappa^\theta=\kappa$, and we are done.
The key equality is of course $\kappa^{\sum_\alpha \mu_\alpha}=\prod_\alpha \kappa^{\mu_\alpha}$, which is proved directly: The sum $\sum_\alpha\mu_\alpha$ is the cardinality of the disjoint union $\bigcup_\alpha \mu_\alpha\times\{\alpha\}$, and we can identify any function $\phi$ from this union to $\kappa$ with the sequence of functions $(\phi_\alpha\mid \alpha<\theta)$ given by $\phi_\alpha=\phi\upharpoonright \mu_\alpha\times\{\alpha\}$. This is actually a bijection between ${}^{\bigcup_\alpha \mu_\alpha\times\{\alpha\}}\kappa$ and the Cartesian product $\prod_\alpha {}^{\mu_\alpha\times\{\alpha\}}\kappa$.