Why do people like to listen to sad songs? Why do people like to listen to sad songs?

Sadness is not a positive feeling, so people should avoid it, right? Listening to sad songs is like inflicting some pain to yourself just for pleasure.

Did someone studied this? Why do people like sad songs? Is it similar mechanism to masochism? What is evolutionary role of feeling sad on purpose? What is neurological background of this phenomenon?
Maya Tamir's work probably sheds the most light here.  Her work suggests that we're not merely trying to avoid bad feelings and promote good ones.  Instead, we want to feel what's most useful to us.  We want to feel emotions that help us realize our goals (Tamir, 2009).  If we think sadness has some positive behavioral value, then we'll try to upregulate it.  

Rumination is an extreme example of this kind of focus on negative feelings, where chronic ruminators share metacognitive beliefs about the positive value of focusing on negative feelings and thoughts (e.g., Papageorgiou &amp; Wells, 2001).  They think that rumination helps them to understand their feelings and prevent future mistakes, even though it's ultimately maladaptive.