I also believe it's due to the group. The best game in the world isn't going to go on for very long without the right DM and players.
All other things being equal, though, there are two things (I believe) that makes D&D well-suited for long-term play.
1. Levels. This is ironic, of course, because it's one of two things (classes are the other one)that D&D haters look down on D&D for--but it's actually one of the game's greatest strengths. Levels are literally the carrot on the string. Not only is every level gain at least somewhat significant, but players can look ahead and see what they'll get next level, and 5 levels from now, and so on. There are few games out there where people routinely talk about what their concrete plans are for their character 6 months or sometimes a year or more in advance (when I get to 10th level I'm going to...)
2. Robustness. This is a word that we used to describe what some might call the "complexity" of the game (or, if they were feeling more generous, the "intricacy" of the game), but what it really means is how much there is to do with the rules, an dhow many bits and pieces there are to the rules that can all interact in interesting and meaningful ways. For example, because there are both levels and feats, there are things you can do with either mechanic but not with the other, or you can have them modify or manipulate each other. Then, when you can add in spells, skills, magic items, races, prestige classes, templates, and more, it gives a real robustness. The advantage that robustness gives to the long-term play experience is that it keeps things from feeling the same. If you had a game that had only feats--no levels, no skills, etc. you'd run that risk must sooner. (And this is a gross simplification of D&D's robustness. Many other things play into it. Far too many to list.)
While I'll grant that some things in D&D are too complex, and that there's still plenty of room to improve D&D, I cringe when I see people talking about simplifying the game. Simplification of D&D could very well be a bullet in its head.