One way is by using spells that have a delayed effect. Harry could cast a spell on Snape's chair in the classroom that would turn it into a whoopee cushion hours later when Snape is in a meeting with other professors. He also uses his skills at misdirection. He might make it seem like another student is the culprit by leaving false clues. For example, he could place a Gryffindor scarf near the scene of a prank where Snape's potion has been magically colored bright orange. Since Gryffindors are known for their mischief, Snape might suspect a Gryffindor student other than Harry.
Harry often enlists the help of his friends. Hermione, with her vast knowledge of spells and magic, can help him create pranks that are difficult to trace. Ron, on the other hand, can be a distraction. For instance, Ron can start a fight with another student near Snape while Harry casts a spell to make Snape's shoes untie themselves. Also, Harry sometimes uses magic items like the Marauder's Map to know exactly where Snape is at all times, so he can plan his pranks when Snape is alone and less likely to have witnesses.
He uses his knowledge of the castle's secret passages. By using these, he can quickly disappear after a prank. For example, if he turns Snape's quills into snakes during a class, he can run into a passage right behind his seat and be gone before Snape realizes who did it.
Well, he could use the power of friendship. Maybe with the help of his friends like Hermione and Ron, they come up with a plan. They might find evidence that Snape has been involved in some really bad things that go against the wizarding laws. Once they present this evidence to the proper authorities, like Dumbledore or the Ministry of Magic, Snape could be gotten rid of. Also, Harry might have some sort of prophetic dream that gives him the key to getting rid of Snape, just like he had dreams about Voldemort in the original series.
In some fanfictions, Snape might use his advanced knowledge of potions to create a special concoction to heal Harry. He could draw on his skills in Herbology as well to find rare ingredients for the potion.
Maybe he discovers some ancient spells or incantations that don't need a wand. These could be spells that were forgotten over time but are still effective. He spends time researching in old books and uncovers these wand - less magic techniques.
Well, he could use his magic skills secretly. Maybe he casts a spell on the Dursleys to make them docile or distracted long enough to get Harry out. For example, he might use a Confundus Charm on them so they don't notice Harry leaving.
Another possibility is that Snape uses his position as a teacher. He might threaten Lockhart with the consequences of harming a student. Given Snape's intimidating presence and his own power within the school, Lockhart would be afraid to cross him. Snape could also call for other teachers to help, making it clear that he won't let Lockhart get away with any harm to Harry.
Harry might enlist the help of other magical creatures. For instance, he could ask the house - elves in the kitchen to add a special ingredient to the twins' food that makes them speak in rhymes for a day. This would be a unique and unexpected prank. The twins are so used to being the ones in control of the funny situations, and this would really catch them off - guard. Also, Harry could use his knowledge of advanced spells he learned from Dumbledore or other professors to create elaborate pranks that the twins haven't thought of. For example, a spell that makes their footsteps sound like they are walking on a trampoline wherever they go in Hogwarts.
Maybe if Snape had revealed his true loyalties earlier. Harry would then understand that Snape was on his side all along. This could lead to them getting along as they both fought against Voldemort. Snape's sacrifices for the wizarding world would make Harry respect him.
Harry could also outwit Snape by using his quick thinking and ability to improvise. Suppose there is a situation where Snape is trying to catch Harry doing something wrong. Harry might use the chaos around him, like a commotion caused by other students, to his advantage. He could blend in with the situation, making it seem like he's innocent while actually achieving his own goals, like getting access to a restricted area for a noble reason that Snape doesn't initially understand.
Perhaps Snape uses magic to create a distraction at the Dursleys' place. He could make strange noises or apparitions that scare the Dursleys, and while they are in a panic, he grabs Harry and disapparates. This would be a quick and efficient way for him to rescue Harry.
In this type of fanfiction, Snape could simply intimidate Vernon. Snape has an air of mystery and a certain power about him. He might show up at Vernon's doorstep, give Vernon a cold stare, and with his reputation as a powerful wizard, Vernon might be too scared to oppose him. Snape could then just take Harry without much resistance from Vernon.