Growing up, Evan Treborn and his friends, Lenny and siblings Kayleigh and Tommy Miller, suffered many severe psychological traumas that frequently caused him to black out. These traumas include being coerced to take part in child pornography by Kayleigh and Tommy's father, George Miller (Eric Stoltz), being nearly strangled to death by his institutionalized father, Jason Treborn (Callum Keith Rennie), who is then killed in front of him by guards; accidentally killing a mother and her infant daughter while playing with dynamite with his friends; and seeing his dog being burned alive by Tommy.
Seven years later, while entertaining a girl in his dorm room, Evan discovers that when he reads from his adolescent journals, he can travel back in time and redo parts of his past. His time traveling episodes account for the frequent blackouts he experienced as a child, since those are the moments that his adult self occupied his conscious, such as the moment his father strangled him when he realizes that Evan shares his time-traveling affliction. However, there are consequences to his revised choices that dramatically alter his present life. For example, his personal time-line leads to alternative futures in which he finds himself, variously, as a college student in a fraternity, an inmate imprisoned for murdering Tommy, and a double amputee. Eventually, he realizes that, even though his intentions to fix the past are good, his actions have unforeseen consequences, in which either he or at least one of his friends does not benefit. Moreover, the assimilation of dozens of years' worth of new memories from the alternative timelines causes him brain damage and severe nosebleeds. He ultimately reaches the conclusion that he and his friends will never have good futures as long as he keeps trying to fix the past, and he realizes that the only thing keeping his friends from having good lives is himself.
Evan travels back one final time to the day he first met Kayleigh as a child. He intentionally upsets her so that she and Tommy will choose to live with their mother, in a different neighborhood, instead of with their father when they divorce. As a result, they aren't subjected to a destructive upbringing, don't grow up with Evan, and go on to have happy, successful lives. Evan awakens in a college dorm room, where Lenny is his roommate. As a test, he asks where Kayleigh is, to which Lenny responds "Who's Kayleigh?" Knowing that everything is all right this time, Evan burns his journals and videos to avoid altering the timeline ever again.
Eight years later in New York City, an adult Evan exits an office building and passes by Kayleigh on the street. Though a brief look of recognition passes over both of their faces, they both decide to keep walking.

Question: How did Evan Treborn discover that he could travel back in time? 
Answer: By reading his adolescent journals. 
Alternative answer: It happened when he read his old journals.