during your 4th year of medical school, you will apply to and interview at residency programs for the specialty you decide to pursue. residency is not tied to what medical school you attend. theoretically, you can go anywhere for residency regardless of what medical school you attend (translation: you can find your way closer to home), but this depends on your performance in school, your board scores, your specialty of interest, etc.
basically, after you interview at programs during 4th year, you will participate in the match. you rank the programs you checked out, and the programs rank the students that they interviewed. then, on one magical thursday in march of your 4th year, you will open an envelope that will tell you where you will spend the next 3 or more (depending on specialty) years of your life. you have to go wherever you match to, it's a bound contract more or less. or, if you prefer, you can rank only a few choices and if you don't get them, risk participating in the Scramble, where you try to get into whatever open spots are available in residency programs that didn't fill up.
just go to medical school, work hard, find out what you are interested in, and hopefully things will take care of themselves. good luck...
if anyone wishes to correct me on any parts of this, feel free. this is merely a lowly applicant's perspective on the residency match.