Gary was a "nice guy" beta male, which is why Karen passed him over
Gary was too meek, too needy, and too much of a stalker/observer.
The ending of the movie came as no surprise to me, since that would have been the realistic ending in any real life scenario where a similar situation occured.
The fact that Gary would actually pay for a girl's abortion (who got impregnated by another guy) goes to show that he lacks boundaries & principles. He's obsessively infatuated with Karen and he winds up learning the hard lesson of what happens to guys who are obsessively needy.
This video does a good job highlighting and explaining Gary's creepy & needy behaviors:
https://www.youtube.com/watch?v=ES72FcKnnts
This film should be shown to every guy in high school as an example of how NOT to attract a woman.