Said straightforwardly it seems like a remarkably simple question. The obvious response is to say that they're the fictional equivalent of the roller-coaster or the bungee jump. Selling you the illusion of danger from a place of complete safety. But in many ways, the origin of the genre comes from a place much less to do with adrenaline and more to do with psychology. Horror movies act as a safe environment in which our darker impulses and fantasies can be released, exorcised and eventually cleansed. In most horror movies, our surrogate is rarely the hero of the piece, rather we enjoy and are entertained by the terror and violence the villain unleashes and often we are on his/her side until the finale in which our moral indiscretion is appropriately chastised with the villain being defeated by someone who nine times out of ten is virtue incarnate, or at least becomes that way during the course of the movie. The villain punishes us for who we are and the hero is who we aspire to be.
So in that sense horror movies, or at least the less complex mainstream ones, represent our own guilt and need to be punished for all our sinful and impure ways. In the same way victims are often representations of wrong doing we experience in reality, rather then the exaggerated monsters that punish them. They may be promiscuous, amoral and jerks in some shape or form, not black and white evil, but the guy with the knife, or the ghost in the closest or the zombie that walks the earth is out to cleanse all forms of human imperfection until what is left is only the most resourceful, most noble and virtuous. In many ways horror films act is a compartmentalized version of a biblical judgment day, in which the villain is subtextually not the villain at all and instead a version of Loki, who in the context of a movie is perfectly justified in killing of whores and bullies.
We only change allegiance when the villain goes after our final girl, our final boy or whatever. The character who represents what we in the audience are supposed to aspire to and thus by passing this twisted form of judgment they defeat it. This is to say that horror movies, in their own indulgent way, are conservative morality tales, tauting age old Christian values and grotesquely punishing those who don't follow them. Just as the Bible does. The simpler horror movies at least. The Halloween's, The Scream's and the Nightmare on Elm Street's of this world.
But its clear that these movies only explore darkness and malevolence in order to exorcise it, and in that sense are much less subversive then they appear. We see these movies because whether our intellect and rational consciousness agrees or not, we subconsciously crave punishment for our indiscretions and thus seeing this done in horror movies is quite cathartic, however childish that world view might be. But the thing is once you've seen this play out more then a few times, it is inevitable that you are going to clock on to this not so subtle form of moral conditioning. Thus to ensure its own survival, the simple horror movie discovered post-modernism and irony, in a display of resourcefulness to put Neve Campbell to shame. By making light of itself, with horror comedies and spoof's and even to the particularly well educated satire's ( Although a satire is basically a spoof with the addition of subtlety, but usually their making the same points.) They could secretly push the same agenda under the guise of self-deprecation, its like Stringer Bell says, if product goes stale you don't start anew you just repackage. I may be the first person to compare the selling of drugs to horror movie subtext, and I feel good about it. Anyways, People are stupid and you should treat them as such. Meaning we can take what we always took from these films and have our own familiarity appeased too, thus selling us the same thing and allowing us to feel superior about it. The greatest trick that a perpetuator of morals or business can pull is making the individual thinks he matters, because they are much more likely to bite your ideology/merchandise if they think that they do.
With more complex horror films, however, its a different game entirely. Rather then trying to put you in your place, ethically speaking, they are more about exposing uncomfortable areas of your psyche and dis-affirming formula and the comfort that it brings. they're about making you realize things about yourself and what you believe that leave you in a place much less entertaining and much more terrifying. Both in terms of what's on screen and the crisis of identification you have with the monster rather then then hero, and in many cases the revelation that the hero is secretly the monster all along. Or they are forced to become one. There is morality in these kinds of films, but its more convoluted and the right choice isn't paved in bright lights. For example in Rosemary's Baby, forced to choose between her love for her child and the knowledge that it is very very evil. She chooses love over right and wrong. And can we really condemn her for this? Not in all honesty anyway. Similarly in films that focus solely in the villain, and there is no redeeming hero to speak of, American Psycho for instance, or Portrait of a serial killer. We are given no choice but to experience the world through a monster's eyes, and in many ways we are behind them every step of the way. It acts as a particularly twisted form of wish fulfillment that nobody wants to openly acknowledge, but every-one feels. There's a reason why a large percentage of all fiction, rather then just horror, focuses on violent confrontation in some shape or form, it just sugar coats it with moral justification. Batman beats up bad guys because its the right thing to do. Neo and Trinity kill shitloads of cops because it the right thing to do. Jack Bauer tortures and kills millions because its the right thing to do. We create this double standard because violence is something we all want to experience but don't because of the icky moral complications. So in our fantasies we create worlds where there are no implications and violence is the right and just thing to do. The horror genre is the only one to openly and consistently call bullshit on this, because in these worlds violent fantasy has consequences. People bleed when you cut them, and scream when you hurt them. They don't coddle you for what you experiencing and force you to face it and what it means.
So, for all the criticism it gets and all the protestations of crassness and inadequacy, quality horror films present a fantasy that does not exalt or celebrate or rationalize your dark impulses. A mirror is held up to all the twisted shit you allow you inner sicko to enjoy and you're forced to face up to this, so by facing darker desires honestly, and not burying them in a pit of moral panic like the Hostel's and the thousand other generic horrors out there, they have a much more valid point about the nature of human darkness and in a tribute to our own weirdness, we appreciate them for their honesty.