Note: someone asked "what happens to older programmers?" on Quora. I wrote this answer.
My few cents:
1. We all need to acknowledge that age discrimination exists and is bad (more reading: "What it Feels Like to Be Washed Up at 35"). People have acknowledged the gender gap in tech industry, but not that much of age discrimination.
2. I've worked with several older programmers (in their individual contributor role) in recent years. They are good, as good as other colleagues in any age. Some work on service products and do on-call (aka. pager) the same way as the young folks (those in 20s). I see age is just like other attributes like gender and race. They are orthogonal to job performance.
3. It is fair to ask about "why this guy is in the same job level as other folks who are 20 years younger? Shouldn't he/she have advanced his/her career quite a lot in the last 20 years?". To some extent, that's something the recruiters and hiring managers better probe, because that's about a person's growth trajectory. Past trajectory is a useful reference to evaluate a candidate's future growth potential. When looking for the answer of that question, it's important to use unbiased eyes. There could be many reasons. For example, the candidate has flatten at a senior job level, which may be OK to some employers. The candidate may have chosen to much slow down his career advancement in exchange for other things like taking care of sick family member. The candidate may be relatively new to the profession, though he/she is relatively older. That happens. Some people switch profession in 40s. They deserve a fair chance.
4. Although it's true that there can't be that many management positions, it's understandable and OK for many young programmers to want to be a manager in the future. Just like it's understandable and OK for many kids to want to be the President of the United States, although there can't be that many President positions (usually there are only 1 in every 4 years). Over the time, among those young programmers who want to be a manager, some of them will become managers, while some others will figure out that either manager is not the right job for them, or they are not (yet) the right person for the manager job.
5. Many people believe that older people are not suitable, at least not competitive, for the programmer job. Their reasons are usually about the energy level, the physical fitness, the need to spend time on kids, the fast evolving technology landscape, etc.. Except for the last one (fast changing technology landscape), all the other reasons are obviously irrelevant or trivial at the best. Take truck driver as example. Truck driver is a relatively physically demanding job. It's intuitive for people to ask "what happens to older truck drivers". People may think that young drivers are more productive because they may be able to go on for longer hours between rests. They may think young drivers have the advantage that they don't need to spend time on kids. Similar to how people view young programmers vs. old ones.
But according to online data (File:Truck driver workforce by age.PNG), there is a large portion of older truck drivers and the number is somewhat growing over the last 10 years (see the 55-64 and 65+ age groups):
None of the consequences due to aging, neither the physical ones (e.g. declining memory) nor the social ones (e.g. time spent on kids), would be a problem to the programmers in general.
6. Regarding the fast evolving technology landscape. Actually that may be just a perception or a partial view rather than full truth, depend on how you look at it. It's true that we used to have no more than a handful choices of databases (Oracle, SQL Server, DB2, MySQL, PostgreSQL, Sybase) but now there are countless choices of databases, most being NoSQL databases. On the other hand, if you look at The Top 10 Programming Languages, the top guys are all decades old: Java, 20 years; C, 43 years; C++, 32 years; PHP, 20 years. Even C# has 15 years already. Although every a year or two there are new language features and new programming frameworks for these programming languages, those are just the normal needs of continuous learning as also seen in many other professions: accountants are faced with tax code and regulation changes every a couple years; for teachers, course books keep changing and in particular, there is the new Common Core; etc. In general, to be successful in any profession, one needs to be a lifelong learner.