Mastering is the final process to finish a mix. Some say to polish or to make it louder, but it is more.
During Mastering, the engineer has a focus on the whole picture of the track, gives it some glue and character, so that it sounds more full and round, but always with the specific genre in mind.
Another task is to adjust levels and frequencies, so that different songs match together. Of course it is also about technical aspects like mono compatibility or different loudness requirements for streaming platforms, which becomes more and more important, since the loudness war seems to end.