In Harry Potter and the Half-Blood Prince, the sixth book in the series, Harry wins a vial of Felix Felicis from Hogwarts’ new potions professor, Horace Slughorn, who had previously held the same position for many years, and taught Tom Riddle as well as Harry’s mother Lily. Slughorn has a crass habit of cultivating close relationships with promising students, such as the celebrity Harry Potter. As Dumbledore describes it, Slughorn has a need to “collect” witches and wizards who stand a chance of becoming famous in the future.
Riddle had once been a member of this “Slug Club” of promising students, likely another reason Slughorn was so willing to provide the young Voldemort with information about the vile dark magic that would make him nigh invincible. In Harry’s day, Slughorn is ashamed that he helped Voldemort, and tries to keep their illicit conversation a secret. He even goes so far as to alter his own memory of the event. But Harry, under instructions from Hogwarts headmaster Albus Dumbledore, uses his clout, the memory of Lily, and a little help from Felix to get Slughorn to tell the truth about what he told Riddle fifty years prior.
In order to get the memory he needs from Slughorn, Harry drinks the Felix Felicis in order to get good luck, a kind of performance-enhancing drug for accomplishing magical tasks. He runs into Slughorn on the way to Hagrid’s cabin by “happenstance,” setting off a chain of events that ultimately leads Slughorn to reveal the true memory of that fateful day in his office with Riddle.