Thoughts on the whole "Nice guys get dumped on in favor of jerks" thing.
1. Don't be "nice". Be good. There is a difference between a "Nice Guy" and a good man. A good man will do the right thing, regardless of whether it comes across as "nice". The nice guy (and in this post I'll use the term to refer to the kind of guy who would actually say "Nice guys get dumped on in favor of jerks" out loud) is so invested in everyone thinking of him as nice, that he does bad things out of peer pressure or - more often - does nothing when he should do something, because someone might not like it.
2. Being nice does not mean anyone owes you anything. A "nice guy" will often have a sense of entitlement, and not even realize it. "I shouldn't have to work at getting a girlfriend. Look how nice I am! Why doesn't [girl I like] see it?" So instead of confidently asking her out, he'll do "nice" things for her so she'll see how nice he is and fall for him. This becomes frustrating because, if she's not already a friend, it can come off as stalkerish. If she is a friend, well, he's just doing what friends do. The whole time, the "nice guy" will be thinking, "Why doesn't she see/appreciate everything I'm doing for her? I'm so nice!" This brings us to the next point...
3. If you're a friend, be a friend. A friend-zoned nice guy often (but not always) becomes the go-to guy for the object of his affections to talk about her relationship problems. Because he's non-threatening, she feels she can open up to him. So he hears about the problems she's having with her SO, and this adds to his frustration because why is she still with this guy if he's such a jerk? There's a perfect guy right in front of her, and he'd never do those mean things to her!
If you truly do care about her, respect that she's with someone else. If she becomes available, then ask her out. But don't mope and pity yourself because she's not with you.
4. The guy she's dating is probably not a jerk. Just gonna throw that right out there. Some women do repeatedly, tragically, date and marry guys who treat them like crap, but I tend to think that happens less often than "nice guys" think. The nice guy is usually projecting. He sees the other guy as a jerk because he's a rival. If I think a girl should belong
towith me, obviously any other guy she's with is not good enough for her, right? And there's a more primal reason - a rival male is threatening. Males fight over females all over the animal kingdom.
This may be compounded by the issue discussed in point 3 - he may only hear about it when her boyfriend does something mean or insensitive, so he never really gets to know who the boyfriend really is.
5. Be confident. The quality that gets mistaken for "jerkiness," I am convinced, is confidence. Confidence is attractive. Jerks usually have it (after all, you have to have a certain amount of confidence to treat others like crap and not care), but not everyone who has it is a jerk. The "nice guy" usually doesn't have it, and he's jealous of those who do, even if he doesn't realize it himself. He hopes the girl he likes will see how nice he is, but he doesn't ask her out because he's afraid of rejection. Protip: Confident guys are afraid of rejection too. It takes courage to ask a girl out, especially if you care what she thinks of you. But the difference is, a confident guy goes into it assuming she'll say yes. And when she says no, if he respects her he'll accept that even if he doesn't like it.
EDIT: Another aspect of confidence is having opinions of your own. Don't be so caught up in impressing her that you agree with everything she says. It usually comes across as insincere. If you're confident in yourself, you can be yourself without worrying if she'll like you. (Thanks to Ceric's article below for reminding me of this one)
Another point Serpie brings up: Arrogance and confidence go hand in hand, and it can be hard to tell the difference between the two. Confidence is sexy; arrogance is not. It's a fine line, but it's all about respect. If you respect yourself, you'll be confident. If you respect others, you can be humble as well. Humility does not mean thinking badly of yourself - it means thinking accurately of yourself.
Where the "nice guy" sees arrogance, the "girl-who-dates-jerks" might see confidence. Either or both of them might be right. Keep it in perspective, and remember that right or wrong, it's her decision to make.
I say all this from the perspective of one who considered himself a "nice guy" for years, and never got dates. So most of that stuff above, I did. It wasn't until later that I looked back and saw that a lot of the things about me that I thought made me a nice guy actually came across as kind of creepy. It didn't change until I was helping an attractive friend of a friend move into her new apartment. A week later, she asked me out. I had no ulterior motive, and no romantic intentions toward her - and that made the difference. I helped her with no expectation of reward, and she saw that. It was a turning point, because not only did I get a confidence boost, it made me objectively reexamine the reasons for my previous lack of a love life. If I really was attractive enough for a more-or-less stranger to ask me out, what had I been doing wrong before?
And one final disclaimer: "Nice," as I use it in this post, is different from "kind". Kindness is always a good thing, and I encourage everyone to show kindness to everyone they meet. What I rail against is the kind of entitled "nice guy" who thinks he's being kind, but is really being a doormat and/or being nice in hopes of a sexual reward. I heartily subscribe to the maxim, "Don't mistake my kindness for weakness."