  The observations of GW170817/AT2017gfo have provided us with evidence that
binary neutron star mergers are sites of $r$-process nucleosynthesis. However,
the observed signatures in the spectra of GW170817/AT2017gfo have not been
fully decoded especially in the near-infrared (NIR) wavelengths. In this paper,
we investigate the kilonova spectra over the entire wavelength range with the
aim of elemental identification. We systematically calculate the strength of
bound-bound transitions by constructing a hybrid line list that is accurate for
important strong transitions and complete for weak transitions. We find that
the elements on the left side of the periodic table, such as Ca, Sr, Y, Zr, Ba,
La, and Ce, tend to produce prominent absorption lines in the spectra. This is
because such elements have a small number of valence electrons and low-lying
energy levels, resulting in strong transitions. By performing self-consistent
radiative transfer simulations for the entire ejecta, we find that La III and
Ce III appear in the NIR spectra, which can explain the absorption features at
$\lambda\sim 12000$-14000 A in the spectra of GW170817/AT2017gfo. The mass
fractions of La and Ce are estimated to be $>2\times 10^{-6}$ and $\sim$
(1-100)$\times 10^{-5}$, respectively. An actinide element Th can also be a
source of absorption as the atomic structure is analogous to that of Ce.
However, we show that Th III features are less prominent in the spectra because
of the denser energy levels of actinides compared to those of lanthanides.
