In some versions, Harry might call for help from his friends or even some Hogwarts ghosts. But mainly, his own determination and his bond with Hermione are crucial. He might sense Hermione's danger through their friendship and arrive just in time. He could use a shield charm to protect Hermione from the troll's blows and then use a levitation spell to lift the troll and drop it somewhere far away from them.
Well, in many such fanfictions, Harry might use his magic skills. He could cast a powerful stupefy spell on the troll to stop it in its tracks and then quickly lead Hermione to safety. Maybe he also uses his quick thinking and knowledge of the Hogwarts corridors to find a hiding place where the troll can't reach them.
Well, in many fanfics, Harry might use his quick thinking and swimming skills. He could have found Hermione using his magical connection to her or by following the signs in the underwater maze. Maybe he used a spell to break whatever was binding Hermione and then swam her back to the surface.
Well, in some versions, they might use their knowledge of the castle's secret passages to lead the troll away from Hermione. They could also work together as a team, using their Slytherin cunning to outwit the troll.
Well, in some versions, Fred might use his quick-witted magic skills. He could cast a distraction spell to draw Bellatrix's attention away from Hermione. Maybe a spell that creates multiple illusions of himself, confusing Bellatrix long enough for him to grab Hermione and disapparate them to safety.
Well, perhaps he uses his influence in the wizarding world. Maybe he has some connections or knowledge that allows him to intervene and get Hermione out of the abusive situation. For example, he could use his status among the pure - blood families to put pressure on the abusers.
Well, in some versions, Ron might use his quick wit and knowledge of Hogwarts' secret passages to outmaneuver Draco. He could lead Hermione to safety through a passage that Draco doesn't know about.
In some versions, Hermione might use her advanced magic knowledge. She could have discovered a spell that counteracts the pull of the veil. Maybe she found a way to disrupt the dark magic associated with it and was able to pull Sirius back from the brink just in time.
One reason could be that the troll is simply on a rampage and Hermione was in the wrong place at the wrong time. Trolls are not known for their intelligence, and it might have just stumbled upon Hermione while wandering the Hogwarts halls.
His courage becomes more evident. By saving Hermione, he shows that he is willing to face great danger for his friend. This act of heroism can make him more confident in his abilities as a wizard.
Well, it could be that Lucius uses his powerful influence in the wizarding world. Maybe he intimidates Ron with threats related to his family's status or he uses some dark magic to create a distraction and whisk Hermione away.
Well, perhaps Snape uses his position as a teacher to step in. He could have been observing the situation secretly and when Draco was about to do something harmful to Hermione, Snape intervened with a firm command or some magic spell to stop Draco in his tracks.