Original: The exception to this rule is when a chord contains a second, in which case the stem runs between the two notes, the higher being placed on the right of the stem and the lower on the left.
Simplified: The length of a stem is usually that of an octave on the staff, going to either an octave higher or lower than the notehead, depending on which way the stem is pointing.