Synopsis
During a survey mission, the crew discovers a dog in a unicorn-lion costume. This is easily the best thing to happen in the whole episode.
A transporter malfunction splits Kirk into a pair of doubles, who we'll call Klumsy and Kreeper, though there's a delay between the creation of the duplicates so they don't know for a while. Klumsy goes to Kirk's quarters, while Kreeper goes to Yeoman Rand's quarters. Kreeper tries to rape her, and she scratches his face.
As Klumsy and Spock talk to Rand, there's a reminder of why Star Trek is so good: Spock says, the only logical conclusion is that there's an imposter aboard.
The ticking clock is that Sulu and the survey team are still planetside, and it gets super cold at night. They can't beam them up, since the Enterprise wouldn't be able to handle the result—which (as we'll learn later) would probably be Sullen and Slutty. They do try to beam down equipment, but the duplication process makes both of them (space heater and specious hunk) useless.
Spock and Klumsy hunt for Kreeper, and capture him—with the first vulcan neck pinch. All throughout, Klumsy has been too timid to really command the ship, and Spock proposes that Kirk needs both halves to be an effective leader.
Things continue along these lines, and ultimately Klumsy and Kreeper are reintegrated using the transporter, and the survey team is saved.
Commentary
I read once that a story can be surprisingly obvious about its theme, and readers/viewers don't mind, and may not even explicitly notice. The Cowardly Lion leads the fight against the Wicked Witch, the Scarecrow plans their attack, and the Tin Woodsman cries all the time. By the time the Wizard of Oz tells them they had courage, a brain, and a heart all along, the viewer believes him.
It's only since I've become a small business owner that I've really come to appreciate how much you need both your "dark" and "light" sides to be able to manage authority. I won't overstate this and say that people are always trying to take advantage of you, but enough of them are, that pessimism is a survival trait. Only by having darkness yourself can you effectively see it in others. And only by having light yourself can you effectively see it in others.
This is a funny situation, since "The Enemy Within" is an incredibly hokey episode—though I think every transporter episode is hokey—and the Good Kirk/Bad Kirk concept is hokier still. After all these years, I've never actually watched "Tuvix." It seems like "Realm of Fear" only exists to refute "um actually transporters kill you and replace you with a clone" stuff. "The Enemy Within" is probably the best take on transporter nonsense.
Also, McCoy says (of a failed attempt to reintegrate doge with dawg), "He's dead, Jim."
Truly, the dream.