This kind of work tends to be an extreme combination of frustrating and rewarding. It definitely takes a certain temperment. There are some laws in place to provide legal fees (fair market rate legal fees) to attorneys who prevail in certain civil rights cases.
Of course, in addition to public defenders, prosecutors also tend to be overworked and underpaid. Many public defenders and prosecutors stay long enough to feel like they’ve done some good, pick up a lot of trial experience, and then turn to private practice; then there are the “lifers.” I had a number of friends in law school who turned their backs on the $140,000/year jobs straight out of law school (more or less the going rate for top law school graduates at big firms in the summer/fall of 2007, when I graduated) and instead joined the public defender’s office (some of them) and the district attorney’s office (others of them). They were mostly the true believer types…I think they’ll be there until retirement.