Everyone on planet Earth, and likely a few aliens by this point, have encountered some rage-inducing internet user that gets off on making you mad. This video explains what makes them tick. As the video explains, studies of users who self-identify as "trolls" (a fact that already says plenty about how these users think) showed that many of them have a high tendency towards sadism. Getting joy from the pain of others gives them an incentive to be argumentative or disruptive.
The video goes on to point out that having a tendency towards sadism doesn't necessarily imply criminal behaviour -- they also point out, rather aptly, that many of us enjoy watching violent movies or sports -- but that this behaviour can become destructive when applied to faceless internet users that the trolls can't see, in a consequence-free environment.
Ultimately, the advice this video gives is the same one that you've always heard: don't pay attention to trolls and they're more likely to leave you alone. It should be noted, however, that this video doesn't distinguish between general trollish behaviour and outright harassment, nor does it give any tips for what to do when an antagonistic user continues to harass you online. Still, understanding how they think is always a step in the right direction.