Find an employer that values career programmers? We have a "Technical Fellow" career path for devs/engineers/architects who want to remain in a technical role beyond the typical "tech lead" or "principle whatever" roles.
Open your own consulting firm. The people you contract with, generally will not care if you're a 55 year old programmer so long as you can get the job done on time and on budget. Further, as you grow the business, you create your own security, as you can eventually turn yourself into more of a business owner/operator/manager, than only a programmer. This is one of the better ways to beat ageism in tech.