Really it's been over the entire course of TW1/2, but specifically in TW2 there were several events that gave Geralt visions of the past concerning his death, the Wild Hunt, and near the end, Ciri.
-First, he remembers his own death during the opening interrogation with Roche. During which he also remembers his lover Yennefer.
-Second, he remembers details about Yennefer being taken by the Wild Hunt from "their secret island," Malus Island (the Isle of Avallach as it is said in the game) in Loc Eskalott which is where Ciri brought Geralt and Yennefer to "protect them" from the riots. Yennefer is abducted by the Wild Hunt and the Hunt destroys the island, leaving Geralt in the ashes. This prompts Geralt to return to the world and the Witcher's Path.
-Third, he remembers his pursuit of the Wild Hunt. He recalls several attacks of the Hunt and some of his own ordeals. It's mentioned that the Hunt has abducted a total of 23 people between the ages of 10 and 20, and Yennefer is the only one who does not meet this age requirement.
-Fourth, he remembers how he met Letho. He saves Letho and two of his Viper mates from a powerful monster, and they join him in his pursuit of the Hunt.
-Fifth, they find the Hunt at the Hanged Man's Tree. All of the abducted persons are there. It's made very clear that the Wild Hunt is not comprised of normal wraiths; while a regular wraith cannot be "killed" or "removed" normally, the "wraiths" of the Wild Hunt were physically injured and destroyed by the Witchers' swords, and drew blood. It's revealed that the Wild Hunt are invaders from another world, or sphere; Elves whose land was taken, similar to the Elves of the world we play in. Geralt makes a deal with their leader and exchanges his soul with Yennefer's, which sets Yennefer free and binds Geralt to the Hunt.
Enter the opening cinematic of TW1, where Geralt is fleeing from the Wild Hunt.
Through each of these visions, he receives a part of his memory. It is presumed that by the fifth vision he has regained all of it.