Only an asshole cares how old somebody is. Reminder also, ageism isn't just a bummer, it's illegal.
Most people aren't going to take legal action, but imo if you're discriminated against you have somewhat of an obligation to do so.
Another factor to consider is post-peak-comp. You may find yourself in roles when you are older that pay less than they used to. This may very well be fine because you no longer have a down payment or kids college to save for, and if you didn't keep upgrading homes.. your mortgage payments 10-20 years into owning should a smaller and smaller percent of your income. If you are no longer chasing comp, you have a broader selection of roles and can be more selective.
Very few of them have been pushed out of the field. Yes many moved up, but the majority still code. The ones who had not moved into management are either retired (Over 65), retired early (Rich, big payday) or dead.
It's easy to blame ageism, and ageism is real. There are a lot of people who really resent older people and believe flat-out untrue myths about cognition, value of experience and work ethic. That said, every time a friend shares a beer with me and tells me the woes of trying to get a job when older, I hear this:
I can't get a job that pays me like I'm senior, but requires the skills of someone half my age.
The solution is to break out of that box, and either be ok with lower pay, or go for jobs that leverage the value of your experience.
> perhaps due to your own abilities and other special qualities
I'm sure if you looked at yourself, or maybe had someone look with you, that you'd find you have quite a bit to offer when it comes to ability, and especially special qualities. As you get older it's hard to understand what is special because you've seen a lot, and it all seems average.
I am very much the “average programmer”, but I learned a long time ago how to focus on “adding business value”, talking to customers (internal and external), writing, presenting, explaining concepts to non-technical people and even once a decade ago talking to investors and potential acquirers when a startup I was working for when they wanted to talk to the “technical folks”