  Surges are cool and dense ejections typically observed in chromospheric lines
and closely related to other solar phenomena like UV bursts or coronal jets.
Our aim is to address the current lack of inverted models and diagnostics of
surges as well as characterizing their plasma properties. We have analyzed
different surges related to UV bursts observed with the Interface Region
Imaging Spectrograph (IRIS) on 2016 April. The mid- and low-chromosphere of the
surges are examined by getting their representative Mg II h&k line profiles
through the k-means algorithm and performing inversions on them using the STiC
code. We have studied the far-UV spectra focusing on the O IV 1399.8 and 1401.2
\r{A} lines, carrying out density diagnostics to determine the transition
region properties of these ejections. We have also used experiments performed
with the Bifrost code for comparisons. Thanks to k-means, we reduce the number
of Mg II h&k profiles to invert by a factor 43.2. The inversions of the
representative profiles show that the mid- and low-chromosphere of the surges
have temperatures mainly around T $=6$ kK at $ -6.0 \le \log_{10}(\tau) \le
-3.2$. For the electronic number density, $n_e$, and line-of-sight velocity,
$V_{\mathrm{LOS}}$, the most reliable results from the inversions are within $
-6.0 \le \log_{10}(\tau) \le -4.8$, with $n_e$ ranging from $\sim1.6 \times
10^{11}$ up to $10^{12}$ cm$^{-3}$, and $V_{\mathrm{LOS}}$ of a few km
s$^{-1}$. We find, for the first time, observational evidence of enhanced O IV
emission within the surges, indicating that these phenomena have a considerable
impact on the transition region even in the weakest far-UV lines. The O IV
emitting layers show electron number densities from $2.5\times 10^{10}$ to
$10^{12}$ cm$^{-3}$. The simulations provide theoretical support in terms of
the topology and of the location of the O IV emission of the surges.
