Sometime in the last four or five decades the Powers That Be decided every movie mystery would follow basically the same plot so that viewers wouldn't have to worry about the outcome and would be able to enjoy the movie all the way through. Fortunately for those who prefer to let the future unfold itself, there are still mystery novels.
A mystery is simply something you don't know or can't understand. By the time you understand it, it's not a mystery anymore. Part of the fun of detective stories is not knowing what's going on (at least, not for sure) until the end, when sudden light dawns in the midst of the darkness and you fancy yourself a bit dull for not having picked up on the clues earlier.
Trying to figure the solution before the main characters get there is pretty fun, too, though there's another kind of satisfaction from waiting till Hercule Poirot or Sherlock Holmes or Lord Peter Wimsey reveal the criminal by name, the extent of his or her crimes, and the motivations that led them to kill, steal or lie. Though in the end, most of us probably end up in both categories, trying to figure everything out but still surprised by the truth.
Modern mystery novels tend to focus on criminal evil, fascinated by the depths humans are capable of sinking to. While older ones certainly didn't hesitate to point out man's depravity and capacity for wrongdoing, they were even more concerned with justice and the good guys who overcome the bad guys through superior wit and reason.
These are the ones we like. We don't admire Sherlock Holmes only for his formidable genius, but also for his commitment to employ it for the forces of good. Miss Marple doesn't need to solve crimes, but she does—and we rejoice every time she triumphs over a shady perpetrator. In the real world things might not always wind up so neatly, but it's nice to know in some books they always will.