Mastering is an art, not a science.
Mixing is treating all the elements of a track individually to get the greater result of each section, and then joining all the pieces in a coherent balance.
This is the step that glues the details of a song to make them become a total, a single stereo wave.
Mastering is the process of preparing an audio mix for its distribution. It is the final step on which a track gains body, presence and definition.
Stem mastering is a hybrid between mixing and mastering. It is mastering a track by sections, that way there’s still space to work on the trickiest elements before finishing the track.