Climb the stairs and go back inside the castle. When entering the castle tower, you will see Zelda locked up and unconscious, while Ganondorf is sitting on the throne. He was able to come back using the hatred of Midna's people and wants to rule the world thanks to his piece of Triforce. At the end of the cutscene, Ganondorf will possess Zelda's body and there begins the final fight!
Ganon's puppet: Zelda
Avoid her Triforce attack by getting out of the triangle mark as soon as possible and also avoid her diving attack when she is raising her sword. When she is throwing energy balls at you, swing your sword to send them back at her, like in a tennis game, until she can't reflect it anymore and gets hit. Do this twice more to defeat her. During this fight, you can find hearts and even a fairy by breaking pots.
Once the magical walls have disappeared, Midna will come back and use her magic to free Zelda from Ganondorf's hold.
Dark Beast Ganon
The boss will then turn into some kind of bull. A reddish ball of light will appear in different places, and when the light turns blue, it means Ganon will emerge from it. Shoot an arrow at his forehead when he is facing you, then quickly run to him and strike his belly several times. When he is roaming around the room, just avoid him and wait for his arrival to stand right in front of him. After hitting him three times, he will change his behaviour and arrows won't hurt him anymore. (Midna will let you know.)
Turn into a wolf. Once more, the reddish light ball will appear, then when it turns blue, Ganon will come out of it. Stand right in front of him and use your Z lock to target him. As soon as it's indicated at the bottom of the screen, press and hold the A button to seize him, then move the joystick from left to right and from right to left to slow him down. After a few seconds, Midna will succeed in knocking him down. Now quickly run to him and bite his belly several times. Do this twice more to beat him.
Princess Zelda will come back to her senses, Midna will transform using the Fused Shadow in an attempt to get rid of Ganondorf, then warp both Hylians to Hyrule Field. Ganondorf has turned back to his normal form and is riding a black horse holding Midna's helmet. There, Zelda will call for the four Spirits of Light and will receive the Light Arrows. You are now horse-riding with the princess at your back.
Get close to Ganondorf while avoiding his attacks and use the Z lock. When you are close enough, Zelda will aim at him and shoot an arrow. If Ganondorf gets hit, get close to him to hit him with your sword. Do this twice and the final phase will begin. When the ghost riders show up, do a spin attack to get rid of them and refill one heart.
Dark Lord Ganondorf
Now you have to duel him in a sword fight. Use your Back Slice and your Jump Strike. One of the valid techniques is to go around him from the left (the side where he doesn't hold his weapon) without the Z lock to backstab him. You can also get near him so he raises his sword, then avoid his attack and counter-attack him. During this duel, you can find some hearts and even a fairy by breaking skulls. If you have the Magic Armor, you can put it on not to lose any hearts. After hitting him around ten times, Ganondorf will kneel. Give him your Ending Blow to force him to surrender.
After the Spirits of Light appear, Midna will recover her human form. The children return to Toal where Rusl's wife had her baby. Then, Link, Zelda and Midna say farewell in the Mirror Chamber and the Twilight Princess goes back to her twilight world. Our hero saved Hyrule once again!