Atomic nitrogen as a probe of physical conditions in the interstellar medium