Many people believe Snape is very nasty towards Neville because Neville could have been the Chosen One or because his parents were aurors, but I donāt agree with those headcanons.
Neville is a traumatised boy. His parents were tortured so badly that they lost their minds. Heās grown up without them with a very strict grandmother as his guardian. His family is an old pureblood family and while they are against the pureblood ideology, they still expect a lot from their heirs. Nevilleās parentsā fate most likely only increases pressure put upon him. Nevilleās uncle almost killed him to squize some magic out of him, as if saying that itās better to be dead than a Squib. Neville got his fatherās wand instead of the one who chose him, as if being told that he had to be like his father, even if heās just a sad, scared child.
All that turns Neville into a soft version of Obscurial. He doesnāt fully control his magic. We see it especially during the Potions lessons. At the very first lesson Neville somehow turns his potion into a very corrosive substance that melts his couldron and forces his classmates to climb on their desks. Later in the fourth year we hear that he melted six couldrons during about three months. Neville believes himself to be almost a Squib, but heās very powerful. All the other students who donāt always succeed in Potions only manage to make some too watery or too thick fluid of the wrong colour that simply doesnāt work, doesnāt do anything.
I can imagine Snape having nightmares about Neville with a melting couldron, surrounded by poisonous fumes, killing Harry Potter and Draco Malfoy and all the other students, because Snape hasnāt managed to make him understand. Those lessons must be terrible for him. In this class thereās Harry Potter who looks like his father that used to bullied Snape, who is disobedient and inattentive, and whose presence reminds Snape of his enormous guilt. Thereās also Draco Malfoy who tells his family everything and who has to believe Snape is on his side like a good Death Eater, so that in the future his influencial father can be his witness before Voldemort. Thereāre also Crabbe and Goyleāalso sons of Death Eaters. Itās already very stressful and then thereās Neville with his dangerous potions that can kill everybody in a minute.
Snape doesnāt know how to deal with someone like Neville. Snape has no pedagogical education, no experience. He learnt how to teach by imitating his own teachers who finished school in the first half of the 20th century or even in the 19th century. About a decade before Snape started teaching, physical violence was still allowed as a punishment at Hogwarts.
Itās worth noting that Snape doesnāt take points from Neville and he only gives him one detention after he melted six couldrons.
So what Snape does to Neville is deeply wrong and very misguided but itās just an attempt to teach him Potions. It doesnāt stem from malice or personal revenge.
And we know it, because when Snape begins to teach DADAāafter Neville was encouraged by Lupin, after he learnt much in the Dumbledoreās Army, after he fought in the Ministry, after he got his own wand, after he gained a lot of confidence in his magical abilitiesāSnape doesnāt bully Neville. It proves that it was a matter of Nevilleās performance at Potions, nothing more.