The plot involves an obsession with the 23 enigma, which is the idea that all incidents and events are directly connected to the number 23, or to some number connected to 23.
Walter Sparrow (Jim Carrey) is an Animal Control Officer and married to Agatha (Virginia Madsen); they have a son, Robin (Logan Lerman). At a bookstore, Agatha begins looking at a book titled The Number 23 written by Topsy Kretts. She later gives Walter the book as a birthday present.
Walter starts reading the book, noticing odd similarities between himself and the main character, a detective who refers to himself as "Fingerling". Walter begins to have dreams of murdering Agatha. Walter tries to warn her about the number being dangerous and how it was going to come after her. She tells him he is crazy.
Walter comes to realize that he is Topsy Kretts, having written the book as a way to rid himself of the guilt he felt over murdering a woman named Laura Tollins (Rhona Mitra). He was never suspected of the crime, and a man named Kyle Flinch (Mark Pellegrino) was convicted and imprisoned instead. Fearing he will hurt his family, he leaves home and moves to a hotel.
Agatha finds Walter at the hotel and tries to assure him that he is no longer the person he was when he wrote the book. He insists that he is a killer, accepting the fact that he murdered Tollins, and tells Agatha to leave before he kills her, too. Agatha pushes a letter opener into Walter's hand, saying that, if he is indeed a killer, he can easily kill again and dares him to kill her. She tells him that she loves him. Walter tells her that she can't love him because no one can, mirroring an accusation made by Laura on the night of her murder. He leaves the hotel and runs into the street, where he nearly allows himself to be run over by a bus but steps out of the way at the last minute when he realizes his son is watching. As he embraces his family, a voice-over by Walter tells the audience that he turned himself in to the police and is awaiting sentencing, having been told that the judge will likely go easy on him. A funeral procession takes place in front of Tollins' grave, where it is implied her body has finally been laid to rest, as Flinch observes, finally a free man.
What does Walter nearly allow himself to be run over by?
Bus