Overview:
Taking a planet Ganymede for example (moon, technically I suppose). Ganymede is huge (well, in contrast to other bodies) and I've noticed a pattern between larger bodies and atmospheres. Usually it seems that the larger a body is, the more likely it will have an atmosphere (I know this isn't true, but it definitely seems true, with obvious exceptions). Even when playing Kerbal space program I came up on Vall expecting to be slowed due to its huge size. Big mistake, slammed into the surface. So, if size isn't the end-all-be-all of why a planet would have an atmosphere, what really causes it? Why wouldn't something like Ganymede, doubly protected by it's own magnetic field and Jupiter's field not have an atmosphere? What causes the planet to lose it once an atmosphere is created?
You can ignore my overview rambling, I suppose my one-liner focused question is:
What are the real conditions for the creation of an atmosphere/loss of an existing atmosphere?