This is more complicated than you want it to be, but make sure you read this and understand it before you accept anything:
Service for HPSP:
First, be aware that if you take HPSP you have to through the military match, and take their residencies even if there is a civilian residency that you would rather have. You can apply for the opportunity to participate in the civilian match instead, but these opportunities are rarely granted. The odds of matching into certain specialties in the military match are not always the same as in the civilian match. Mostly they're very close, and a few give you slightly better odds, but there are a few residencies (EM in particular) that are significantly harder to get into the military, and a few (dual residencies like IM/Peds) which are not available at all without a deferment to the civilian match.
If you go through the military residency system, the time you owe the military at the end of residency is either the legth of your residency (not counting the first, or 'intern' year) or the number of years of medical school they paid for, whchever is more. If you get a deferment and do a civilian residency you owe the number of years they paid for in medical school no matter what.
However the Navy residency system mostly works the way the civilian residency system worked a generation ago, meaning you don't match
into an entire residency, you just match into an intern year and then apply for the rest of residency at the end of that intern year. If you don't match at all at the end of intern year, which is not only a real possibility but actually happens to the majority of military docs, you go do what is caused a GMO tour for at least two years. This means being a sort of basic primary care physician for a group of warfighters (pilots, marines, the doc on a ship, etc), and at the end of those two years you will have the chance to reapply to residency. The time you spend as a GMO will count against your obligation (which is the number of years HPSP funded for you to go to medical school), so if you owed 4 years going in you will owe 2 when you start residency.
However, and this is the important bit, the amount of time you owe at the end of the residency you matched into is either the obligation you had going in, or the length of residency, whichever is more. So if you go into a 4 year otho residency after doing a 2 year GMO tour at the end of that residency you will owe the same 4 years you would have owed if you matched directly out of intern year.
So, some examples:
4 years HPSP, 3 year straight through residency, time you owe at the end of residency: 4 years
4 years HPSP, 5 year straight through residency, time you owe at the end of residency: 4 years.
4 years HPSP, intern year, 2 years GMO, last 2 years of a primary care residency, time owed at the end of residnecy: 2 years
4 years HPSP, intern year, 2 years GMO, last 4 years of an ortho residency, time owed at the end of residency: 4 years.
Finally you always retain the option of just doing an intern year, serving out your entire 4 year obligation at a GMO, and then doing the civlian match to finish your residency.
BTW if you want a straight thorugh residency you are most likely to get it in the Army, then the AF, and then the Navy. The Navy currently is attempting to reduce the number of GMOs so that we have less than the AF (though probably still more than Army) but who knows if that will happen.
Placements in the Navy:
Yes, then can deploy you, and they can place you anywhere. You will give them a preference list of where you want to go, but needs of the Navy are very much the top priority. If you don't want to be stationed abroad (other than wartime deployments) you probably won't have to since those are very popular locations.