I started wondering about this in the recent STEM thread. As someone now in their early 30s I'm starting to wonder what the mid-late career as a software developer looks like.
Do you have to go into management to continue progressing upwards in pay and influence? I know this isn't the case at some companies (e.g. Google), but is it rare or common to progress as an individual contributor?
Is there a plateau in pay? Is there a drop in pay switching jobs after a certain number of years experience because places are looking for 5+ instead of 20+?
Are older devs not looking for new jobs because they have families and want more stability/are focussed elsewhere?
Is becoming a specialist rather than a generalist the answer?
And lastly: if you're in your late 30s, 40s, 50s, what are you doing at your job? What are the older people in your workplace doing?
There's been a constant push towards management that I've always resisted. People I've known who have gone into management generally didn't really want to be programming - it was just the means to kick start their careers. The same is true for any STEM field that isn't academic. If you want to go into management, do it, but if you don't and you're being pushed into it, talk to your boss. Any decent boss wants to keep good developers and will be happy to accomodate your desire to keep coding - they probably think they're doing you a favor by pushing you toward management.
I don't recommend becoming a specialist in any programming paradigm because you don't know what is coming next. Be a generalist, but keep learning everything you can. So far I've coded professionally in COBOL, Basic, Fortran, C, Ada, C++, APL, Java, Python, PERL, C#, Clojure and various assembly languages each one of which would have been tempting to become a specialist in. Somebody else pointed out that relearning the same thing over and over in new contexts gets old and that can be true, but I don't see how it can be avoided as long as there doesn't exist the "one true language". That said, I've got a neighbor about my age who still makes a great living as a COBOL programmer on legacy systems.
Now for the important part if you want to keep programming and you aren't an academic. If you want to make a living being a programmer, you can count on a decent living, but if you want to do well and have reasonable job security you've got to learn about and become an expert in something else - ideally something you're actually coding. Maybe it's banking, or process control, or contact management - it doesn't matter as long as it's something. As a developer, you are coding stuff that's important to somebody or they wouldn't be paying you to do it. Learn what you're coding beyond the level that you need just to get your work done. You almost for certain have access to resources since you need them to do your job, and if you don't figure out how to get them. Never stop learning.