You can put down as many programs as you want (or can afford). After the first batch, you have to pay extra. So you'll want to have some limit on the total number. Following your submission through ERAS, programs interested in you will let you know that they would like to interview you. You then go and interview. Following all of you interviews, you make an ordered list of programs you are interested in attending. The programs do the same. A big computer then matches you up (look at the NRMP website for details). The following July 1 you start at your new program.
EM is complicated somewhat because there is currently a transition to a direct 4 year program from the transitional + 3 year model. Other people can tell you more about this.
Ed