For IM your chances of getting a straight-through residency are pretty good.
The way it works is this: you pick a specialty, say EM, as your #1 choice. On the form they have the various training locations where you could do EM. For the AF, there are only two: San Antonio and Wright Pat. You rank these #1 and #2, and usually put "civilian deferred" as #3.
Now there is another form in the JSGMEB package that asks you if you would like to do a civilian or military internship if you don't match to your residency. You'll pick one of those, do the internship, then be a FS/GMO. A caveat here is that if you want to do something like Anesthesia or Radiology then you HAVE to pick a military internship, as these military residencies are tied to their internship programs. You rank the locations of the various internships as you did for your residency choices.
So basically the way it works is that there are a couple of different "boards", one that picks the people going into residencies and another that sorts through those applying for internships. What happens is that your app first goes to the board picking residents, and if you don't get picked for your residency than you go before the internship board, which decides whether you go into a prelim or transitional year and where.
In the AF you don't go before the board again until after you do your internship and a two-year FS or GMO tour, at which point my JSGMEB application will consist of a Polaroid of my middle finger.