Given a (finite) group $G$ and its commutator subgroup $G'$, when is it the case that $$1\to G'\to G\to G/G'\to 1$$ splits?
Specifically, can we say anything if we add the assumption that $G'$ is abelian ($G$ is nilpotent of class 2), or more generally if $G$ is nilpotent?
EDIT It is most interesting to consider this question when $G$ is a $p$-group. We may furthermore simplify this by supposing that $G$ is a $p$-group of exponent $p$ (ie. $g^p=1$ for every $g\in G$), and therefore both $G'$ and $G/G'$ are both elementary abelian.
If $G$ is nilpotent and $G' \ne 1$, then $G'$ does not have a complement in $G$.
Because if it had a complement $Q$, say, then $Q \cong G/G'$ would be abelian, so $$G' = [QG',QG'] = [Q,Q][Q,G'][G',G'] = [Q,G'][G',G'] \le [G,G'].$$
But if $G$ is nilpotent with $G' \ne 1$ then $[G,G']$ is the next term in the lower central series of $G$, so it is strictly contained in $G'$, contradiction.