When does an injective group homomorphism have an inverse? Given two groups $A$ and $B$ and an injective homomorphism $f : A \to B$. When does a homomorphism $g : B \to A$ exist with $g\circ f = \mathrm{id}_A$ (but not necessarily $f\circ g = \mathrm{id}_B$)? 
 A: If and only if $B$ is a semidirect product of $A$ and another group (the latter is normal). One direction is obvious, and another direction is easy: $B$ is a semidirect product of the image of $f$ and the kernel of $g$. 
A: If you look at this problem from the side of $B$, i. e. how do we find endomorphic retracts of a given group, then there's also somewhat definite answer. 
Define equation over group $G$ with coefficients in $H \le G$ as a collection of elements $w_i \in H * \mathrm{Free}(x_1, x_2, \dots)$. Solution of an equation is a homomorphism $\phi: H * \mathrm{Free}(x_1, x_2, \dots) \to G$ identical on $H$ and such that $\phi(w_i) = 1$.
Let's call $H \le G$ algebraically closed (should be not confused with algebraic closure of a group, nor by Levine nor Farjoun) if every system of equations $w_i(X_1, \dots, X_l) = 1$ with coefficients in $H$ have solution in $G$ if and anly if it has solution in $H$ already. 
It's clear that every retract of a group is algebraically closed; сonverse is true if subgroup is f. g. (A. Myasnikov, V. Roman’kov, Verbally closed subgroups of free groups, 2014). Also see this paper about conditions weaker than algebraic closedness https://arxiv.org/pdf/1702.07761.pdf.
