Mastering is preparing a collection of mixes for release by creating a compliant production master for the particular medium.
That's the short answer...
Micro-tweaking (EQ, dynamics, stereo field), level 'matching' (for lack of a better term), fading spacing, PQ editing, overall playback levels, etc.
Generally performed by a specialized engineer using specialized equipment in a specialized space (that part causes a lot of arguments in the 'less seasoned' crowd, but that's how the pros handle it - and there are reasons for that).
Most of what is marketed as "mastering software" is... not.
For a bunch of the other stuff, you might browse a few mastering facility web sites...