  The abundance of nitrogen in the interstellar medium is a powerful probe of
star for- mation processes over cosmological timescales. Since nitrogen can be
produced both in massive and intermediate-mass stars with metallicity-dependent
yields, its evolution is challenging to model, as evidenced by the differences
between theoretical predictions and observations. In this work we attempt to
identify the sources of these discrepancies using a cosmic evolution model. To
further complicate matters, there is considerable dispersion in the abundances
from observations of DLAs at redshift 2 - 3. We study the evolution of nitrogen
with a detailed chemical evolution model and find good agreement with
observations, including the relative abundances of N/O and N/Si ratios. We find
that the principal contribution of nitrogen comes from intermediate mass stars,
with the exception of systems with the lowest N/H, where nitrogen production
might possibly be dominated by massive stars. This last result could be
strengthened if stellar rotation which is important at low metallicity can
produce significant amounts of nitrogen. Moreover, these systems likely reside
in host galaxies with stellar masses below 10**8.5 solar mass. We also study
the origin of the observed dispersion in nitrogen abundances using the
cosmological hydrodynamical simulations Horizon-AGN. We conclude that this
dispersion can originate from two effects: differ- ence in the masses of the
DLA host galaxies, and difference in the their position inside the galaxy.
