The U.S. Army Air Force had a limit of how many missions you could fly before rotating home and the U.S. Army had a points system that decided when you went home. Did the Navy have a system in place that determined when a sailor went home?
Sailors stayed with their ships, mostly for the whole war. Schools and such took some away, and only some of those came back. You could go on leave if the ship was going to be in port for an extended period. No transportation would be provided for leave from an overseas port insofar as I know, with the possible exception of a family emergency.
Sailors could be sent to special school related to their military profession. If a draft came through for people to man new construction or the like the "needs of the Navy" would take precedence. One of my great-uncles, on a destroyer in the Pacific, went to a school in Norfolk and wound up in the Atlantic Fleet after completing the course. He had been advised to take everything with him, but he didn't listen. Friends of his on his prior command shipped most of his stuff to him when they had an opportunity.
Ship rotation usually was 2 to 3 years at sea then you could get rotated to either another ship or to a shore command. Sailors on ships that were going into longer term repairs or refits often had a portion of the crew transferred to other ships that were working up for deployment. Seabees were a different thing entirely where the manpower was assigned to units based on their civilian skill set. Rotation off a ship could be delayed if you were on one that was deployed and didn't go into a US yard for an extended period of time. If you were sent to a school for more than a few days to a week or two, same thing. You could be assigned to a different command or ship than you came from due to your billet being filled while you were at the school. Officers were a bit different. They got rotated off a ship usually based on promotion. Thus, a junior officer that was a division officer might go to a new ship as a department head upon promotion as the ship he's on doesn't have a slot for him. XO's became prospective CO's and would be give a command of their own. Also, the Navy took very few draftees. It was almost entirely a volunteer service and usually could pick and choose who got taken in the recruiting process. That simplified the who gets out when thing when the war ended. If your ship was being decommissioned, you were usually allowed to end your service if you weren't part of the decommissioning crew. Otherwise, most sailors got out when their current enlistment expired if they didn't reenlist. The Navy might also not allow some sailors to reenlist as they were not needed in peacetime.
Submarines in the Pacific had a fairly regular routine of patrols around 60 days, and it was common for 10-15% of the crew to be detached and replaced after each patrol, going to schools and/or new construction, since of course the fleet was continually expanding. Thus the boat would have a mostly experienced crew, new men could learn from the veterans, and new subs would have a core of combat-experienced sailors. Men who'd served several combat patrols would get a break before going out in a new boat.
I can imagine you would need a break from being in a submarine. You can't imagine how cramped it is until you are in one.