Mastering a song is when you use plugins like compression, equalization, saturation, and limiting to, generally speaking, make your song sound professional. Mastering comes after mixing and it’s the last stage before you release the song.1
More specifically, mastering makes your song louder (in both volume and perceived volume), it polishes up your song so it sounds better,2 and it makes your song sound good on any kind of speaker.
Basically, you want your song to sound like you recorded in a professional studio. Your song should be able to sit on a playlist next to the big pop artists and blend in.
But the most important thing about mastering is that it gives you a second opinion . . .