You run them as a program, and are able to load the ROMs of files. As for how their inner workings work, I don't know, but they try to emulator (hence the name) the way that the consoles work. Of course sometimes the older consoles game writers used to use mechanical tricks in their games, which make them difficult to emulate, but people are dedicated.

I'd like to know how people get the roms though. That's what's ttly beyond me:o