It depends on the place. Many places have overlapping shifts to help with this, so the new doc comes on an hour before the old doc leaves. That way the new guy can take all the new patients while the old doc can clean up charts and dispo as many patients as possible (discharge vs admit). Other places don't overlap their shifts so several of these patients will be "signed out" to the new doc coming on so that they can leave at a reasonable time. For example, if you need to rule out an MI you have to sit on the patient for a minimum of 6-8 hours to get the needed cardiac markers back from the lab. This patient would be signed out to the new attending meaning they would get the full history of present illness, med history, outstanding lab values, consultations, etc.
Regardless, in my experience an ER doc rarely leaves right at the end of their shift. Most stay 30 minutes to an hour after the shift is over to make sure their patients are dispo'd and all critical labs and studies are ordered. Shift change always presents a myriad of possibilities for mistakes (as is true in any job or profession), so EDs try to minimize these mistakes as much as possible and staying a little longer than your shift technically ends is a way to accomplish that.