I'm all over the place on this topic, so let me just shoot out some points on what motivates me:
1. I create plugins because I have the skill, knowledge, and time to do so.
2. I like the WordPress platform (for the most part), and the community that has grown up around it.
3. There is definitely the "helping others because I enjoy it" mentality as GamerZ mentions, but I also get something out of it as an intellectual and technical pursuit as well. I like to learn, to educate myself in many areas. This is one of them.
4. There is an egoistic side to this, in that a plugin gaining any sort of broad use or popularity can add to and enhance ones own. The limelight can be a big draw. Still, it's certainly not why I wrote my first plugin, and probably won't be why I'll write my next. See points above for that.
5. Your question could also be directed towards those who spend time developing WordPress itself, or provide support here in the forums, or work on the documentation. I don't consider these to be any different. We're all doing a little something to make WordPress better. And that's my final point.