Question: I would like to find a condition for an exact sequence of abelian groups
$$
0\to H\to G\to K\to 0
$$
to split. Assume for simplicity that $H=\langle h \rangle$ is cyclic, and choose a basis for $G= \langle g\_1 \rangle \oplus \ldots \oplus \langle g\_n \rangle$. Write $h= \sum a\_i g\_i$, with $0 \leq a\_i < o(g\_i)$, where $o(g\_i)$ is the order of $g\_i \in G$.

By looking at examples, it seems to me that the exact sequence splits if and only if
$$
\gcd(o(h), a\_1, \ldots, a\_n)=1.
$$
Is this last statement correct? (and, if so, why?)

Answer: 
This is wrong, as shown by the accepted answer to my question on MO:
<https://mathoverflow.net/questions/107768/on-the-existence-of-a-direct-summand-containing-a-fixed-subgroup>

A simple example is the subgroup generated by $\langle (2,1) \rangle $ inside $\mathbb{Z}\_8 \oplus \mathbb{Z}\_2$. This is a subgroup of order $4$ whose quotient is cyclic of order $4$, generated by the equivalence class of $(1,0)$. Clearly $\mathbb{Z}\_4 \oplus \mathbb{Z}\_4 \neq \mathbb{Z}\_8 \oplus \mathbb{Z}\_2$.

The answer of Steve D shows that the GCD condition is necessary, but in fact it is not sufficient as this example clearly shows.
Consider the short exact sequence

$$ 0\to H\stackrel{f}\to G\to K\to 0.$$

Let $H=\langle h\rangle$, and $f(h)=\displaystyle\sum\_{i=0}^n a\_i g\_i$. Then the SES splits if and only if there exists a homomorphism $\phi\ :\ G\to H$, such that $\phi\circ f\equiv id$. Now if $\phi(g\_i)=k\_i h$, then $\phi$ is a homomorphism if and only if

$$ k\_i |g\_i|\equiv 0\pmod{|h|},\qquad 1\le i\le n.\qquad (1)$$

And we have $\phi\circ f\equiv id$ if and only if

$$ \displaystyle\sum\_{i=1}^n a\_i k\_i\equiv 1\pmod{|h|}.\qquad (2)$$

Condition $(2)$ clearly implies the GCD condition is necessary. I think some Chinese Remainder Theorem stuff will show it is sufficient as well.