The picture of the lady in Ted's office is his real-life mother.
This episode pays homage to The Sixth Sense in the way that Dr. Cox sees Ben, but no-one else does. The audience doesn't know this but they do drop a clue. Dr. Cox asks Ben, "Are you still doing that camera thing?" to which Ben replies, "Till the day I die." And after J.D. tells Dr. Cox that the patient died, Ben no longer has his camera.
The initial concept for the janitor was that he was only in J.D.'s imagination. If you watch the early episodes, the janitor doesn't interact with any of the other characters. The idea was eventually abandoned because the character became too popular.
Scrubs creator Bill Lawrence also co-created the show Spin City. Of the ten main actors on Spin City, seven subsequently made guest appearances on Scrubs, some multiple times. The only three who never appeared on Scrubs are Charlie Sheen (Charlie), Connie Britton (Nikki), and Victoria Dillard (Janelle).
Ted's band that recurs throughout the show is a real band called "The Blanks"