Showing $G$ is the product of groups of prime order Let $G$ be a (not necessarily finite) group with the property that for each subgroup $H$ of $G$, there exists a `retraction' of $G$ to $H$ (that is, a group homomorphism from $G$ to $H$ which is identity on $H$). Then, we claim :


*

*$G$ is abelian.

*Each element of $G$ has finite order.

*Each element of $G$ has square-free order.
Let $g$ be a nontrivial element of $G$ and consider a retraction $T : G \to \langle{g\rangle}$ which is identity on $\langle{g\rangle}$. As $G/Ker(T)$ is isomorphic to $\text{Img}\langle{g\rangle}$, it is cyclic and so, it is abelian. 
Other than this i don't know how to prove the other claims of the problem. Moreover, a similar problem was asked in Berkeley Ph.D exam, in the year 2006, which actually asks us to prove that:

If $G$ is finite and there is a retraction for each subgroups $H$ of $G$, then $G$ is the products of groups of prime order.


Let $g$ be a nontrivial element of $G$ and consider a retraction $T : G \to \langle{g\rangle}$ which is identity on $\langle{g\rangle}$. As $G/Ker(T)$ is isomorphic to $\text{Img}\langle{g\rangle}$, it is cyclic and so, it is abelian. 
Thus $[G,G]$ is contained in $Ker(T)$. Since $g \notin Ker(T)$, $g \notin [G,G]$. As $g$ is an arbitrary nontrivial element of $G$, this means that $[G,G] = {e}$; that is, $G$ is abelian.
Look at any element $g \in G$ and consider a retraction $T:G \to \langle{g^2 \rangle}$.
$T(g)$ is in $\langle{g^2 \rangle}$ means $T(g) = g^{2r}$ for some $r$. Also, $T(g^2)=g^2$ means then that
$g^{4r}=g^2$; that is, $g^{4r-2} = e$. As $4r-2$ is not zero, we get that $g$ has finite order.
