NASAs Interface Region Imaging Spectrograph (IRIS) space mission will study how the solar atmosphere is energized. IRIS contains an imaging spectrograph that covers the Mg II h&k lines as well as a slit-jaw imager centered at Mg II k. Understanding the observations will require forward modeling of Mg II h&k line formation from 3D radiation-MHD models. This paper is the first in a series where we undertake this forward modeling. We discuss the atomic physics pertinent to h&k line formation, present a quintessential model atom that can be used in radiative transfer computations and discuss the effect of partial redistribution (PRD) and 3D radiative transfer on the emergent line profiles. We conclude that Mg II h&k can be modeled accurately with a 4-level plus continuum Mg II model atom. Ideally radiative transfer computations should be done in 3D including PRD effects. In practice this is currently not possible. A reasonable compromise is to use 1D PRD computations to model the line profile up to and including the central emission peaks, and use 3D transfer assuming complete redistribution to model the central depression.