Let $G$ be a finite group and define the power map $p_m:G\to G$ for any $m\in\mathbb Z$ by $p_m(x)=x^m$. When is this map a group homomorphism?
Elaborately: Can we somehow describe or classify those groups $G$ and numbers $m$ for which $p_m$ is a homomorphism? For example, is the image $p_m(G)$ necessarily an abelian subgroup like in all of my examples? If a group admits a nontrivial $m$ (that is, $m\not\equiv0,1\pmod N$) for which $p_m$ is a homomorphism, is the group necessarily a product of an abelian group and another group?
Observations
The $p_m$ is clearly a homomorphism whenever $G$ is abelian.
Also, if $N$ is the least common multiple of orders of elements of $G$, then $p_{m+N}=p_m$ for all $m$ so the answer only depends on $m$ modulo $N$. (Note that $N$ divides $|G|$ but need not be equal to it.) Also, $p_0$ and $p_1$ are always homomorphisms and $p_{-1}$ is so if and only if $G$ is abelian.
Examples
If $G=C_4\times S_3$ (where $C_n$ denotes the cyclic group of order $n$), then $p_6$ is a nontrivial homomorphism (neither constant nor identity). Its image is $C_2\times0<C_4\times S_3$.
More generally, if $G_1$ is any nonabelian group and $n$ coprime to $m=|G_1|$, then $p_m$ is a nontrivial homomorphism for $G=C_n\times G_1$.