Nitrogen has half filled 2p sub shell
1s2 2s2 2p3
whereas Oxygen has four electrons in 2p
1s2 2s2 2p4
A p shell has 3 sub orbitals
That fourth electron is in an orbital already occupied by another electron, so it is not held as tightly.
why is the ionisation energy of oxgen less than that of nitrogen even if oxygen is to the right hand side of nitrogen?
2 answers
Or one can argue that the nitrogen has a set of p orbitals that is half filled and half filled orbitals (or filled orbitals) are more stable than those that are not.