Here's another good link along with Bakers to MAME setup. It covers pretty much every supported version on the Pi. The 'Arcade' drop down on the left shows the different sections even how to build and validate sets.
https://retropie.org.uk/docs/MAME/
I do keep most of the supported version sets non-merged (ROM set type not emulator) zipped and just extract the ROMs as needed. There is a lot of crossover between version sets if you plan to implement them all it's pretty redundant. Some emulators run certain games better than others so it's usually is a mix-and-match of MAME emulators and ROM/game subsets.