When does a subgroup H of a group G have a complement in G? Let H be a subgroup of G.  (We can assume G finite if it helps.)  A complement of H in G is a subgroup K of G such that HK = G and |H∩K|=1.  Equivalently, a complement is a transversal of H (a set containing one representative from each coset of H) that happens to be a group.
Contrary to my initial naive expectation, it is neither necessary nor sufficient that one of H and K be normal.  I ran across both of the following counterexamples in Dummit and Foote:


*

*It is not necessary that H or K be normal.  An example is S4 which can be written as the product of H=〈(1234), (12)(34)〉≅D8 and K=〈(123)〉≅ℤ3, neither of which is normal in S4.

*It is not sufficient that one of H or K be normal.  An example is Q8 which has a normal subgroup isomorphic to Z4 (generated by i, say), but which cannot be written as the product of that subgroup and a subgroup of order 2.
Are there any general statements about when a subgroup has a complement?  The Wikipedia page doesn't have much to say.  In practice, there are many situations where one wants to work with a transversal of a subgroup, and it's nice when one can find a transversal that is also a group.  Failing that, one can ask for the smallest subgroup of G containing a transversal of H.
 A: Let me mention one other condition. Suppose the finite group $G$ has an abelian Sylow $p$-subgroup $P$ for some prime $p$. Then Burnside's Transfer Theorem says that $P$ has a normal complement in $G$ if and only if $P$ is in the centre of its normalizer in $G$; i.e.  $P \le Z(N_G(P))$.
This often provides the quickest way of showing that groups of a specific order cannot be simple. For example, if $|G|=56$, then $G$ has 1 or 8 Sylow $7$-subgroups. In the first case,  the unique Sylow $7$-subgroup is normal in $G$, whereas in the second case, a Sylow $7$-subgroup $P$ is abelian and self-normalizing in $G$, and hence has a normal complement of order 8. In either case $G$ is not simple. There are alternative ways to prove this without using BTT, but it gets more and more indispensable as the group order increases.
Of course $P$ might have a non-normal complement in $G$ even when the condition fails. For example, in $A_5$ a Sylow 5-subgroup has the complement $A_4$.
In a finite solvable group $G$, by the theory of Hall subgroups, any subgroup $H$  (not necessarily normal) such that $|H|$ is coprime to $|G:H|$ has a unique conjugacy class of complements in $G$.
A: Version 2 of "Factorization problems for finite groups", which discusses bicrossed products (knit products), gives an elementary introduction, classifies some examples, and shows that $A_6$ cannot be written as such a product.
A: If $H$ is normal, then there is a well-known textbook answer.  $H$ has a complement if and only if $G$ is a semidirect product of $H$ and its complement. The complement is isomorphic to the quotient $G/H$, and if you don't know whether there is one, you can do an extension calculation to see if it exists.  For instance, if the extension is central, then the question is whether the 2-cocycle of the extension is null-homologous in $H^2(G/H,H)$.
When $H$ is not normal, I once noticed that the isomorphism type of a complement is not unique.  $S_3 \subset S_4$ is complemented both by the cyclic group $C_4$ and by the Klein group $C_2 \times C_2$, because they both act freely transitively on four points.
It seems reasonable to generally think of a complement of a non-normal subgroup as a freely transitive subgroup of a group action.  This yields a converse answer for "when" it happens.  In particular, every finite group $K$ arises exactly once as a complement of $S_{n-1} \subset S_n$, namely when $n = |K|$.
You can sometimes use topology to know that there isn't a freely transitive action.  For example, $\mathrm{SO}(n-1) \subset \mathrm{SO}(n)$ does not have one when $n=3$ or $n \ge 5$, because otherwise there is no Lie group with the topology of its quotient.  I don't know any very good obstructions in the finite group case, but I bet that there are some.
Thurston (and I'm sure others) has remarked that $\mathrm{SO(3)} \subset \mathrm{Isom}(\mathbb{H}^3)$ has a complement.  It is the homothety group the plane, realized as the stabilizer of concentric horospheres.
A: (This is a follow up question rather than an answer.)  
Wouldn't it make more sense if the complement of a subgroup $H \leq G$ were defined to be a subgroup $K\leq G$ such that $H \cap K = 1$ and $\langle H, K \rangle = G$?  That is, shouldn't we allow for the possibility that the set $HK$, consisting of all products $h k$ ($h\in H, k\in K$), is not a group? (Yet we may still have $HK \subsetneq \langle H, K \rangle = G$ in this situation.)
..or does everyone take $HK$ to mean $\langle H, K \rangle$ in this context?
A: There's an excellent online resource for group theory definitions and theorems called "Groupprops, The Group Properties Wiki."  It's still in pre-alpha, but it has a lot of stuff and hopefully will continue to improve.
In particular, there are a bunch of theorems for figuring out when a p-group has a normal complement which you can find linked from this page.
A: A lot can be said in the finitely generated abelian case, just by using the structure theorem. 
Call a group transversal if every subgroup has a complement; non-transversal of it has proper, nontrivial subgroups, none of which has a complement; and semi-transversal if it is not transversal but some proper, nontrivial subgroup has a complement.
Take a finite abelian group $G=\mathbb{Z}/p_1^{e_1}\mathbb{Z}\times\ldots\times\mathbb{Z}/p_k^{e_k}\mathbb{Z}$ with $r\geq 0$, distinct primes $p_1,\ldots,p_k$ and $e_i\geq 1$. 
Then $G$ is transversal when $e_i=1$ for all $i$, semi-transversal when $k>1$ and $e_i>1$ for some $i$, and non-transversal when $k=1$ and $e_1>1$.
For an infinite finitely generated abelian group $G$, $G$ is non-transversal if $G=\mathbb{Z}$, and semi-transversal otherwise.
Given a finitely generated abelian group $G$ and $S\subseteq G$, call $S$ independent if $0\not\in S$ and for all $x_1,\ldots,x_k\in S$, $r_1,\ldots, r_k\in\mathbb{Z}$, we have that $\sum_{i=1}^k r_ix_i=0$ implies $r_ix_i=0$ for all $i$. Call $S$ a basis of $G$ if it is independent and $G=\left< S\right>$.
Then if $H\leq G$, $H$ has a complement if and only if $H$ has a basis that can be expanded to a basis of $G$.  If $S$ is a basis for $H$ and $S\subseteq T$ for some basis $T$ of $G$, then the complement of $H$ is $\left< T\backslash S\right>$.
So if $G$ is a vector space over $\mathbb{Z}/p\mathbb{Z}$ then any subgroup has a complement, since any subspace has a basis that can be completed to the whole space. My definition of independence is the same as linear independence.
If $G$ is a free module over $\mathbb{Z}/p^n\mathbb{Z}$ then my definition of independence is weaker than linear independence. I would like to say that $H\leq G$ has a complement if and only if it has a module basis, but I can't prove the reverse direction of this.
I know less about the divisible abelian case, except that if $G$ is a divisible abelian group then saying that $H\leq G$ has a complement is the same as saying that $H$ is divisible. In particular $\mathbb{Q}$ and the Prufer $p$-group $\mathbb{Z}(p^\infty)$ are both non-transversal.
A: A partial answer to this question is known as the Schur-Zassenhaus lemma (or theorem). If N is a normal subgroup of a finite group G whose order is prime to its index (such a subgroup is called a (normal) Hall subgroup of G) then N has a complement in G.
Check the Wikipedia page http://en.wikipedia.org/wiki/Schur-Zassenhaus_theorem. I also think that Rotman's coverage of this in his `Introduction to the Theory of Groups' is particularly good; the chapter on group cohomology IIRC.
A: This doesn't quite answer your question, but rather answers the question in the opposite direction.  Thus, while I can't say precisely what subgroups have complements, I can give conditions that the complements must satisfy.
To present a group as $G = KH$ with $H \cap K = 1$ is equivalent to the following:


*

*Maps $\lambda_K : H \times K \to K$ and $\rho_H: H \times K \to H$.

*such that $\lambda_K$ is a left group action of $H$ on the set $K$, and $\rho_H$ is a right group action of $K$ on the set $H$.  Moreover, each action fixes the identity element of the other group.

*and these maps are required to satisfy two coherency conditions:
$$ \lambda_K ( h, k_1 k_2 ) = \lambda_K( h, k_1 ) \cdot \lambda_K( \rho_H( h, k_1), k_2 ) $$
$$ \rho_H ( h_1 h_2, k ) = \rho_H (h_1, \lambda_K( h_2, k) ) \cdot \rho_H( h_2, k) $$
where $\cdot$ is the group operation in $K$ in the first line and in $H$ in the second line.


To prove that this data is equivalent, in one direction observe that the factorization $G = KH$ defines for each $g$ a pair, so let $\lambda(h,k), \rho(h,k)$ the unique elements in $K,H$ such that $\lambda(h,k)\cdot \rho(h,k) = hk$ as elements of $G$, and check that these maps satisfy the above axioms.  In the other direction, the group structure on $K\times H$ is
$$ (k_1,h_1) \cdot (k_2, h_2) = (k_1 \cdot \lambda_K(h_1,k_2), \rho_H(h_1,k_2) \cdot k_2) $$
(Hm, I seem to have switched the order of $K,H$ from your question.  Oh, well.)
In any case, if one of the maps $\lambda, \rho$ is trivial, then the coherency conditions assert that the other action is by group automoprhisms, and $G$ is the semidirect product.  More generally, the construction is due to Zappa-Szep, and is sometimes called the knit product or double cross product, usually written $G = K \bowtie H$.  Groups of this form are called factorized.
A: Given $H \subseteq G$, there are a number of conditions sufficient to guarantee that there exists a $normal$ complement for $G$. One of the more interesting of these is due to Frobenius: Assume that $H \cap H^g = 1$ for all elements $g \in G - H$. Then $H$ has a normal complement in $G$. As yet, there is no proof known that does not use characters.
