I think there are a lot of reasons. Some people just don't like to give up on a relationship, esp. when there's a lot of time invested in it; it's hard to see when you should just cut your losses. Some people don't want to go through all the rigamarole that comes with ending a relationship--telling people why and fielding their questions, making sure everyone's belongings get back to the rightful owner, one or both people moving out if they live together; they figure it's just easier to stay together. Some people don't want to go through the rigamarole of getting back into the dating scene, they figure they've found one person and it'll take a long time to find another and they don't want to deal with it. Some people still hold hope--no matter how misguided it may be--that the relationship can still work.
I think a person could probably come up with just about any reason for staying when they shouldn't.
As well--and this is only a side note, based on the fact that we all probably know someone who's in a relationship we think they ought to leave and in case anyone's approaching this from the view of trying to understand why someone they know stays--I try not to judge others' relationships based on what they say. One of my bosses is always complaining about his girlfriend, seems like at least once a week he's complaining about how she's [censored] at him or something. And it's hard not to say "dude, if you're so miserable, why are you still with her???" But I also know people have a tendency to just complain about the bad things, even if they're really very happy, so I've never said anything to him about it because I don't know if he's truly unhappy and just staying with her because they don't want to split up for whatever reason, or if he's just letting off steam and I happen to hear it. (it's been hard to not say anything though, considering that he and I had a sort of a row once over the fact that I'm staying single. Every time he complains about his girlfriend, I want to say "and you actually wonder why I don't want to have to deal with that [censored]? You really think you're better off than me? You're a walking list of reasons why I should be single; why would I want to be as miserable as you?") So I guess unless the relationship is REALLY obviously bad (i.e. abusive or something, or I see with my own eyes that the pair REALLY aren't compatible and always at odds, or something), I try not to consider whether it's good for the person or not.