That would be by using a reference. The stereo track of the piece to be mastered is loaded in the DAW, and a stereo reference is also loaded. Then it works by comparing both. The very first track of the album would have been compared with a commercial production and notes taken when mastering it. Then the next mixes would follow the same approach, preparing them to be mastered in the same way as the first piece.
That would be the 'by ear' approach. On top of that meters can be added to quantify the sounds, such as a LUFS/LU meter. Ardour/Mixbus provides this information on exports and as an analysis feature. The export itself can have restrictions to go by, like how much headroom to leave (1 dB is usually recommended to allow for further mp3 compression) and what LUFS ceiling to observe, etc. Ardour/Mixbus are fully configurable regarding this.
Mind you, I am still doing mastering 'by the side' as I'm still learning. I should follow a formal course soon, by Michael White (Withney Houston, David Byrne, James Taylor, Jimi Hendrix recording, Mick Jagger, David Bowie, etc, 30 gold records, Electric Lady Studios). I have seen many out there on the market, and some promise the moon and surely spam your email box at large with mixing and mastering 'tips'. Not much for me. Mike is beyond that. If one wants to learn, Mike has the practical knowledge. And the passion. But one has to have the will to learn first. This is one preview of the mastering course:https://www.youtube.com/watch?v=Y7Tk0ED_Wh4
He does not do interviews much, if at all, although if you want to see what the guy is, here's a bit he did for Presonus:https://www.youtube.com/watch?v=VbF4kNW0aCk