How do hospital emergency rooms treat overdoses if they don't know what the person took?

Experience. It's based on clues from emts or family, lab tests including for drugs, ekg, exam of patient, and drug use patterns in the local area (e.g. More cocaine, heroin, alcohol, etc).