This is going to be a somewhat hand-wavy, simplified-version-of-the-truth answer, but I’ll give it my best…
The atomic numbers down the right side of the periodic table (2, 10, 18, 36, 54, 86) are the amount of electrons an element needs to be stable. Hydrogen, with its 1 electron, can share that 1 electron with another hydrogen atom, and both will have stable 2. Helium alread has stable 2, so it can exist as a single atom. But that molecule of hydrogen doesn’t “stick” to other molecules of hydrogen at room temperature, so it’s a gas. Likewise, the atom of helium doesn’t “stick” to other atoms of helium at room temperature (you have to get it REALLY cold before it does, very close to absolute zero), so, again, a gas. The reason for the lack of “sticking,” btw, is most easily explained by the lack of any ability to separate the charges between the two atoms of hydrogen or the 1 atom of helium; there’s nothing to attract a “happy,” 2-electron hydrogen atom in a molecule of hydrogen to another 2-electron hydrogen atom in another molecule of hydrogen.
In order for lithium to get a stable number of electrons, it can lose 1 electron (gain a +1 charge), or, in theory, gain 7 (gain a -7 charge). It isn’t possible to pack 7 of those +1 lithium ions around a theoretical -7 lithium ion (plus the charge density is too high compared to the lowly 3-proton nucleus, anyway), so forming some sort of lithium “molecule” doesn’t work. Instead, a bunch of lithium atoms get together, and essentially each get to temporarily give up their extra electron, sharing it with all of the other lithium atoms in the solid.
Nitrogen, with its 7 electrons, only needs 3 extras to hit the stable 10. It can get this by sharing 3 electrons with another nitrogen atom, so each atom in N2 has the stable 10 electrons. But, again, this molecule of N2 doesn’t “stick” very well to other molecules of N2, so it’s a gas at room temperature.
I don’t think anything is wrong enough there to make anyone have to throw the explanation out the window, but it’s possible someone will come along with a clearer explanation that doesn’t leave quite so much out 
On preview… ZebraShaSha’s lattice explanation is good to include, but there’s no such thing as a lithium “molecule,” per se. “Molecule” generally refers to atoms connected by covalent bonds, and the bonds in lithium are the oft-overlooked “metallic” bond, which is something like covalent but not quite the same thing.