The production stage of a song consists of finding the sounds that make the mix. The mixing stage consists of placing the sounds into the mix through panning, and blending the sounds together through processing. The mastering stage comes after a song is completely finished, and is more technical than artistic. What I mean by this, is that choices made through production and mixing can be up to opinion. Choices made during mastering are more objective. Mastering a song is making sure that the volume doesn't cause any problems with the listening experience. It's made sure that the song isn't considerably louder or quieter than whatever comes before or after it. Mastering makes sure that the dynamics of the song aren't inconsistent, like if a quiet part builds into a loud part. Mastering over a full album ensures that the songs all work together.
Mastering isn't making a song sound good, it's making sure it doesn't sound wrong. Albums where the entire time your ears are being blown out are a tough listen. The music can be written well, but it's hard to listen to. A good example of when a song hasn't been mastered right, is when you turn it up to hear the bass but then the hi hats are too loud. Mastering makes sure that the low end cuts through the mix without overpowering it, and that the high end can still be heard without hurting.
I've heard the phrase, "Leave mastering to the professionals." It's not that mastering is some impossible task, it's more that having another person do this stage can be extremely beneficial. This is because it can be difficult to achieve the sound you're chasing, either due to lack of knowledge or an inaccurate perception of the mix. An inaccurate perception can be caused by an untreated studio, inferior equipment, or simply the way you hear the song in your head. I've written before how you can combat this, but it isn't wrong to let someone else master your music. Personally, I'd rather spend a week pulling my hair out getting a song to sound right than spend money but that's me.
In the past I'll get a song sounding the best I can, and then put a preset from Izotope Ozone 8 on it. I've read that it can be harmful to rely on a mastering plugin, but I'm happy with the mixes I've gotten. I've used the same preset every time, and it's really just a limiter with a little boost. I make sure that the song sounds right before I start messing with it, and a lot of times I forget to even put it on. When I do, it just makes the song better. It actually helped me to better understand the problems I was having with my mixes, because every time I would put the plugin on the low end would clip. From what I understand, to master a song you're supposed to export the full piece into another session and process it from there using various effects. After every album I swear I'm gonna follow this process for the next one and not use the plugin. The biggest issue I see with the preset is that every song is processed the same, but across the others I don't notice a difference in tone only volume.
If you have trouble with mastering try out a plugin, from there it can help you form the knowledge needed to master on your own. I'm still trying to get there, but I think it's more about training your ears through listening to music than it is textbook knowledge.
Thank you for reading!