How does it happen? How do two chunks of rock dance round the ringed planet without ever (so far) bumping into each other? "So far" because this pas de deux has clearly been going on for much much longer than 50 years. If you try to investigate the how and why [let's start at Wikipedia, folks] you are presented with a highly authoritative but deeply confusing diagram that implies the two moons oscillate back and forth in their orbit. This is emphasised by looking at moving-image evidence on youtube which seems to show Janus and Epimetheus coming to a screeching halt every 4 years and going into reverse. It certainly does not help that these orbital relationships are called horseshoe orbits. This is bloody nonsense as explained by the patient people on Quora. The inner moon travels faster than the outer one and eventually catches up with its partner. As they get close the force of gravity heaves them together so that they swap orbits, the inny becoming outy and outy going all inny. The inner moon travels faster and several years later catches up with its tag-partner and they swap places again.
Horseshoe orbits are shown much more clearly by a pair of MOVies in the Wikipedia entry for Cruinthe, a small body in orbital resonance with Earth which is billed by some people from the Arts Block as being our second moon. As one of the QI panellists said at the time "Who comes up with this shit?".