How do we get to know the total mass of an atmosphere? Since atmospheres don't end abruptly but gradually get thinner the higher you go, I wonder how we can get the total mass of an atmosphere if we don't know where exactly it ends. E.g. the Earth's atmosphere's mass is defined as 5.1480 × 1018 kg. Does this value include the exosphere (which doesn't have an abrupt end either)? Or is it up to the exobase only? Or is it even the significant part only, up to the mesopause or to the Kármán line or something?
Also, if we mention the mass of a celestial body, does this value (e.g. in case of Venus 4.867 × 1024 kg) include its atmosphere's mass or not?
There is a simple$^*$ way to know the total mass of the atmosphere: measuring the pressure it exerts on the surface, which necessarily integrate all of the atmosphere above ground level.
If you take an atmospheric pressure of $1\cdot10^5$ Pa, it is equivalent to a force of $1\cdot10^5$ newton over one square meter. Multiply by the area of the planet in square meters, you get the total weight of the atmosphere: $1\cdot10^5 \times 5.1\cdot10^{14} = 5.1\cdot10^{19}$ N. Divide by the acceleration of gravity to convert this weight to a mass: $\frac{5.1\cdot10^{19}}{9.8} = 5.2\cdot10^{18}$ kg. There you go!
$^*$Well, I guess it is simple on Earth, but could be more challenging on other planets...