OP, as the previous posters explained, you are basically starting the whole app process all over again when it comes time to apply for residency. New app service form to fill out, new PS, new LORs, new interviews all over the country if you apply all over the country, etc. etc. You pick the specialty you want to apply for, and some people even apply for multiple specialties with separate PSes, LORs, interviews, etc. So it's pretty analogous to what you have to do to apply for med school. The main improvement on the process compared to applying to med school is that you don't have to fill out any secondaries this time around.
As for the match, what it comes down to is this: you make your rank list, and if there is somewhere you absolutely don't want to go, you don't rank that program. So for example, if you decide there's no way you want to stay at your home school, then you wouldn't include it on your rank list--and you probably wouldn't even apply there in the first place. If you decide you really want to do residency in NYC, you would apply to all the NYC programs in your specialty and go interview at as many of them as invited you. Then you'd rank all the NYC programs where you interviewed at the top of the rank list that you subsequently submit for the match.
At some med schools, it's not possible to stay at your home school for residency even if you do want to. Not every medical school has a residency in every specialty. There are also programs out there in many if not all specialties that are not affiliated with a medical school. These community programs accept med students from all over, just like the academic programs do.
In my case, I don't want to go to a community program, so I didn't apply to any. I also chose programs based on geographic preference and on my perception of their strength in my area of academic interest. That included my home school program, and I did apply there and was invited to interview there--it's my first interview coming up in a few weeks, actually. But I am also receiving invites to interview at programs in other cities and other states.
In your case, focus your med school plans on getting yourself accepted somewhere, wherever you can get in. As cabinbuilder pointed out, not everyone will have multiple choices of schools, especially if you're from a competitive state like CA, and especially if your stats are well below average for the schools you want to attend. If you're a strong candidate and do get into multiple schools, my advice is to pick the one that will let you graduate with the least debt, unless you have a really compelling reason to choose the more expensive school.
Hope this helps, and best of luck.