  In this work we present the galaxy clustering measurements of the two DES
lens galaxy samples: a magnitude-limited sample optimized for the measurement
of cosmological parameters, MagLim, and a sample of luminous red galaxies
selected with the redMaGiC algorithm. MagLim / redMaGiC sample contains over 10
million / 2.5 million galaxies and is divided into six / five photometric
redshift bins spanning the range $z\in[0.20,1.05]$ / $z\in[0.15,0.90]$. Both
samples cover 4143 deg$^2$ over which we perform our analysis blind, measuring
the angular correlation function with a S/N $\sim 63$ for both samples. In a
companion paper (DES Collaboration et al. 2021)), these measurements of galaxy
clustering are combined with the correlation functions of cosmic shear and
galaxy-galaxy lensing of each sample to place cosmological constraints with a
3$\times$2pt analysis. We conduct a thorough study of the mitigation of
systematic effects caused by the spatially varying survey properties and we
correct the measurements to remove artificial clustering signals. We employ
several decontamination methods with different configurations to ensure the
robustness of our corrections and to determine the systematic uncertainty that
needs to be considered for the final cosmology analyses. We validate our
fiducial methodology using log-normal mocks, showing that our decontamination
procedure induces biases no greater than $0.5\sigma$ in the $(\Omega_m, b)$
plane, where $b$ is galaxy bias. We demonstrate that failure to remove the
artificial clustering would introduce strong biases up to $\sim 7 \sigma$ in
$\Omega_m$ and of more than $4 \sigma$ in galaxy bias.
