Energy comparison between an atom and its ion
Ionization energy is, exactly, a comparison of the energy of (i) a given species and (ii) that same species with one electron removed.

Ionization energies can be thought of as a reaction like the following, using the oxygen atom as an example:

$$
\ce{O -&gt; O+} + e^-
$$

When evaluating quantities like the ionization energy, "external" energies (this is my term, not an official/formal one!) like kinetic and gravitational potential energy are disregarded. Further, the reference energy is generally defined to be zero for an isolated electron at "infinite separation".

Thus, the energy of the above reaction is:

$$
E_\mathrm{rxn} = \left(E_{\ce{O+}} + E_{e^-}\right) - E_{\ce O}
$$

But, since the electron is taken as being in its reference state, this is simply:

$$
E_\mathrm{rxn} = E_{\ce{O+}} - E_{\ce O} \equiv IE
$$

PLEASE NOTE that the above energies are only the internal/electronic energies of the $\ce O$ and $\ce{O+}$ species, and not their enthalpies $\left(H_{\ce{O+}},\,H_\ce{O}\right)$, free energies $\left(G_{\ce{O+}},\,G_\ce{O}\right)$, etc.