Original: After Link battles Agahnim for a second time, Ganon rises up from Agahnim's body, turns into a bat, and flies away.
Simplified: After he gets them all, he goes to the top of the tower and battles Agahnim again. He kills him, and Ganon in a bat form flies out of the corpse and into the Pyramid of Power.