Teaching you to make acceptable/the best possible/whatever decisions when you're tired/not at your best for whatever reasons, which will likely happen in the future.
Teaching you how to deal with extreme emergencies, e.g. http://stormdoctor.blogspot.com/2011/06/first-response-mode-..., which may not happen to you, but will statistically happen to a subset of doctors who go through the system.
WRT to that link on what happened in my home town May 23rd, 2011, the local medical response hundreds of lives that night, keeping the death toll down to ~ 160.
It is sub-optimal (to the extent that people die) to train doctors how to make decisions when they're tired by forcing a bunch of doctors to be tired most of the time.
It's kind of surprising that clinician errors kill so few people - about 10,000 (ten thousand) per year in the US.
It'll happen sooner or later, if not done during residency. But residencies have the advantage of a degree of supervision, and in a location where ... I hate to call it a support system, but, still, the people working with them know they're residents and expect them to green et. al.
The alternative is this happening when they're "on their own", even if part of a multi-doctor practice, clinic, ER or whatever. After residency they will statistically be making decisions when they're tired or otherwise not at their best. Didn't sleep well the night before, got woken up because one of their patients is in a crisis and their input is needed (although I gather that's less common nowadays), and there are the unexpected emergencies when their skills are needed without prior warning.
My take on the current system, butressed by all the doctors I've talked to about this, is that it's "optimal" when you consider all the factors. Just focusing on the residency period is insufficient to make a judgement.
It seems to me that it is mostly based on tradition and gut feeling.
Most of the issues with non-resident doctors working when tired could be fixed by increasing the number of doctors and physicians assistants. Of course physicians organizations fight against that as it would lead to lowering their income.
I don't an practical means to obtain "actual evidence", it would require incredibly intrusive tracking of the careers of a bunch of doctors, and deciding the why of adverse outcomes is frequently going to be subjective.
I.e. was it the doctor or the patient? Which patients were more likely to have a bad outcome because of genetics or past history? The subject of "compliance" is sobering, sure you can prescribe a wonder drug, but you can't make the patient take it (aside from some TB regimens where compliance in taking a nasty multi-drug cocktail for 18 month or thereabouts is enforced).
And how does this makes sense? Aircraft pilots have rigid (well, in theory) schedule limits. Of course, this doesn't work all the time, but it's better to try to ensure they're rested than just make them "suck it up" no?
He pointed out the caregiver handoff is also a source of errors--the departing doctor can't fully describe the history and their thought processes about every aspect of every patient they are treating. And people sometimes make mistakes on charts. He said the schedule at his hospital, at least, tries to strike a balance between continuity of care and fully rested doctors.
The demands are also different: pilots don't get called out of their normal schedule to be asked about a problem they observed with plane X the last time they flew it (rather, they're supposed to report it at the end of the flight and mechanics will look at it).
Emergencies also have a different nature, I gather its much more likely you'll be short flyable planes than air crews. A look at the Berlin airlift might be instructive. A book I recently read on the WWII air war in the South Pacific said that was true for both sides. Although of course the rules in wartime are different.