Edit: I rewrote the proof since the initial one (when dealing with groups with nontrivial center) was fatally flawed.
ThisProposition. Given a group $G$, this happens (every exact sequence $1\to G\to H\to H/G\to 1$ splits) iff $G$ has a trivial center and $1\to G\to \mathrm{Aut}(G)\to\mathrm{Out}(G)\to 1$ splits. [The first part of the proof is flawed]
Proof: supposeLemma: Let $Z$ be embedded as central subgroup in two groups $G$ has nontrivial center, $Z$. Let$S$, and let $i$$H$ be the embeddingquotient of $Z$ into$G\times S$ by the centerdiagonal ($*$)$D_Z$ of a perfect group $S$ [note that$Z$. Then the extension $S$ can be chosen finite$1\to G\to H\to H/G\to 1$ split if and only if there exists a homomorphism $G$ is finite]. Consider$S\to G$ extending the "central product": quotientidentity of $H$$S$.
Proof. Interpreting the existence of a splitting by pulling back in $G\times S$ by, we see that the centralexact sequence splits if and only if there exists a subgroup $\{(z^{-1},i(z)):z\in Z\}$$L$ of (i.e$G\times S$ such that the projection of $L$ on $S/Z$ is surjective, and such that $L\cap (G\times Z)=D_Z$. Since using this diagonal, we gluethe projection then necessarily contains $Z$, inthe first condition means that the projection on $S$ is surjective. Thus a subgroup of $G\times S$, both copies has this form if and only if it is the graph of a homomorphism $Z$ through$S\to G$ that is identity on $i$)$Z$. We can view $\Box$
Lemma: Let $G$ be a group and $A$ an abelian group. Then there exists a group $S$ as normal subgroups ofsuch that $H$, intersecting in$S$ has no nontrivial quotient of cardinal $Z$. Then$\le|G|$ and such that the centralizercenter of $G$ in $H$ is equal to $S$ contains an isomorphic copy of $A$.
We claim thatProof: for a field of characteristic zero $K$, consider the semidirect product $S_K=\mathrm{SL}_2(K)\ltimes\mathrm{Hei}_3(K)$ (this is a central extension by $1\to G\to H\to H/G\to 1$$K$ of the standard semidirect product $\mathrm{SL}_2(K)\ltimes K^2$; $\mathrm{Hei}$ refers to Heisenberg). This group has the property that every nontrivial quotient admits the simple group $\mathrm{PSL}_2(K)$ as quotient. Hence is not splithas no proper quotient of cardinal $\le |K|$. Now the center of [False! see below] Otherwise$S$ is isomorphic to $K$ as additive group, writewhich is a vector space over $H=G\rtimes L$$\mathbf{Q}$ which can be prescribed to be of arbitrary nonzero dimension. Then the centralizerSince every abelian group $A$ is subquotient of a group of this form $G$ in($A$ is quotient of $H$$\mathbf{Z}^{(A)}$ which is alsosubgroup of $Z\rtimes C_L(G)$$\mathbf{Q}^{(A)}$), it therefore embeds into some quotient of [Not necessarily!]$S_K$ provided $K$ is large enough. So $S=Z\rtimes C_L(G)$, hence$\Box$
Lemma: let $S=Z\times C_L(G)$ since$G$ be a group with nontrivial center $Z$ is central in. Then there exists a nonsplit extension $S$$1\to G\to H\to H/G\to 1$. This contradicts that
Proof: choose for $A=Z$ a group $S$ as in the previous lemma. By the first lemma, the resulting central extension is perfectnot split, since a splitting would imply the existence of a quotient of $S$ of size between $|Z|\ge 2$ and $|G|$. $\Box$
HenceProof of the proposition: suppose that $G$ satisfies the splitting property. By the previous lemma, $G$ has trivial center, and. Hence the splitting of the exact sequence $1\to G\to \mathrm{Aut}(G)\to \mathrm{Out}(G)\to 1$ follows by assumption.
Conversely, suppose that $G$ has trivial center and this exact sequence splits. Let $1\to G\to H\to K\to 1$ be an exact sequence. Let $Z$ be the centralizer of $G$ in $H$. Then $N\cap G=1$. So this induces an exact sequence $1\to G\to H/Z\to K/Z\to 1$, which is split, so $H/Z=G\rtimes L/Z$ for some subgroup $L$ of $H$ containing $Z$. Hence $H:G\rtimes L$. $\Box$
Note also that the characterization within finite groups is the same, by the remark at the beginning of the proof.
($*$) this is correct but a weaker statement is enough: Every abelian group $A$ is contained in the intersection of the center and derived subgroup of a group $S$.
Proof: let $u$ be the automorphism $(x,y)\mapsto (x+y,y)$ of $A^2$. Note that $(x,y)-u(x,y)=(y,0)$. Then the semidirect product $A^2\rtimes \langle u\rangle$ [which is finite if $A$ is finite] contains $A\times\{0\}\subset A^2\subset A^2\rtimes \langle u\rangle$ as central subgroup, consistingconstruction of commutators since writing $v=(x,y)$ and $w=(y,0)$, the previous equality readsa "big" central extension as $w=vuv^{-1}u^{-1}$ in the semidirect product.second lemma is disappointing if one wishes to somewhat preserve the cardinalities $\Box$
**Edit** Under the setting of the beginning of the proof: I think that the exact sequence splits(which I claimed doesn't) if and only if there exists a homomorphism$S\to G$ that equals "identity" on$Z$. But this can happen, e.g., taking$S=G$: then the splitting comes from the image of the diagonal of$G\times G$ in$H$. [I think we can arrange things(which is not required by choosing $S$ with no nontrivial quotient of size $\le |G|$OP). It might be possible to improve this, but need to check carefully enough)]with some technical cost.