I think the reason people like detective stories, besides the fact that we want to figure out whodunit before the detective does, is that it's thrilling, but it's a safe kind of thrilling, unlike, let's say skydiving, or jumping off a cliff; we know that we aren't taking any risks when we read a detective story, kind of the same reason we love roller coasters. (I know, I know, roller coasters aren't entirely, 100% percent safe, because there might be undetected mechanical problems, or you might have heart problems you don't know about. But the chances of that are preeetttttty rare.)

P.S. I hope this doesn't offend anybody, it's just my opinion.