  This work aims to identify the relevant physical processes in shaping the
intensity and polarization patterns of the solar K I D lines through spectral
syntheses, placing particular emphasis on the D2 line. The theoretical Stokes
profiles were obtained by numerically solving the radiative transfer problem
for polarized radiation considering one-dimensional semi-empirical models of
the solar atmosphere. The calculations account for scattering polarization,
partial frequency redistribution (PRD) effects, hyperfine structure (HFS), J-
and F-state interference, multiple isotopes, and magnetic fields of arbitrary
strength and orientation. The intensity and circular polarization profiles of
both D lines can be suitably modeled while neglecting both J-state interference
and HFS. The magnetograph formula can be applied to both lines, without
including HFS, to estimate weak longitudinal magnetic fields in the lower
chromosphere. By contrast, modeling their scattering polarization signals
requires the inclusion of HFS. The D2 scattering polarization amplitude is
strongly depolarized by HFS, but it remains measurable. An appreciable error is
incurred in the scattering polarization profile if PRD effects are not taken
into account. Collisions during scattering processes also have an appreciable
depolarizing effect. Finally, the D2 scattering polarization signal is
especially sensitive to magnetic fields with strengths around 10 G and it
strongly depends on their orientation. Despite this, its center-to-limb
variation relative to the amplitude at the limb is largely insensitive to the
field strength and orientation. These findings highlight the value of the K I
D2 line polarization for diagnostics of the solar magnetism, and show that the
linear and circular polarization signals of this line are primarily sensitive
to magnetic fields in the lower chromosphere and upper photosphere,
respectively.
