Let $G$ and $H$ be groups. If one has a surjective group homomorphism $f: G \to H$ does there necessarily exist a group homomorphism $g: H \to G$ such that $f \circ g = \text{id}_H$? Similarly $f$ is injective, is there a group homomorphism $g: H \to G$ such that $g \circ f = \text{id}_G$?
I seriously doubt that either statement is true. I'm just asking for counter examples.
I would also like to know if the questions (adapted appropriately) hold in any interesting categories. The category of sets is trivial for this question, clearly.
The result does not hold. For example, there is no injective homomorphism $\mathbb{Z}_2\to \mathbb{Z}$. The type of morphism you are describing is called a section, and existence of one usually implies either some special property of one of the groups or some special relationship between the two groups.
Surjective homomorphisms of vector spaces always have sections. The larger space is isomorphic to the direct sum of the kernel and the image.
For injective homomorphisms, a left inverse is called a retraction. Retractions also usually imply special properties and they need not exist. For example, there is an injection from the free group on infinitely many generators into a free group with two generators, and a retraction in that case is impossible. Injective vector space homomorphisms also always have retractions.