Why nitrogen has higher ionization potential than oxygen?
O has a lower 1st IE than N because O is 1s22s22p4 and N is 1s22s22p3. The 4th electron in the O atom's outer level has to pair up with one of the others, and
this introduces repulsions, which makes it easier to remove.
The relevant factors are nuclear charge, atomic radius and screening by inner
electrons.