Medical school is 4 years in length. The traditional model is that the first 2 years are classroom and laboratory based with a bit of exposure to patients as you learn how to take a history and perform a physical examination. The final two years consist of clinical training in the in-patient and out-patient (ambulatory care aka office ) setting. This can include overnights in the hospital as you rotate through the mandatory training, called "clerkships" as well as electives. There is studying to do and exams as you learn about the various specialties within medicine (internal medicine, OB-GYN, pediatrics, neurology/psychiatry, surgery are the usual mandatory clerkships).
In your 4th year of medical school, you apply for residency. This is at least one year (the minimum needed for licensure) but usually 3-7 years of hands on training in a clinical setting. This can include overnight shifts in the hospital and is limited, at least on paper, to not more than 80 hrs/wk. There are board certification examinations to be taken during residency.
At the end of residency, one can apply for a subspecialty fellowship. For example, internal medicine has numerous subspecialties such as allergy, cardiology, gastroenterology, etc. From psychiatry, one can do fellowships in addiction medicine, child and adolescent psychiatry, etc. Last I heard, there were no limits on duty hours for fellows and they were being slammed picking up the slack for residents who could no longer put in the hours they did before limits were placed on their hours/wk.