I never keep chickens over 2 years old, but i would imagine that productivity gradually declines with age and production birds that churn out egg after egg are probably more likely to burn out faster than other breeds. No harm in having a few retirees in your flock IMO.
It's entirely up to the chicken keeper. I can't say how long they will continue to lay, since I've never had one live that long. We try to process our older hens between 2-3 years of age. They aren't laying regularly by that point, and when we don't process them, they usually die of other causes before they're 4 years of age. My mom has had some live to be around 6 that have still laid infequently. Some people will keep their "spent" hens. others process, sell, or give them away to make room for new ones. It all depends on your management style and why you have chickens.
Mine are mostly pets (although lately I haven't spent much time with them) so I plan on keeping all of mine their whole lives. I am adding some more in October though. Mine will be a year old October 26th and the new ones are hatching October 11th. So when mine start to decrease production the second winter I should hopefully have some young year old pullets going into their first winter. We have 8 chickens right now.
I've heard some chickens live to 6 or 8 and still lay. I have even heard of one chicken 20 years old and still laying. My hope is mine live that long but we will see.
But eventually we may reach a point where they are barely producing and we can't add any more chickens so we may have to cut back but for now I plan to keep all of mine.
My plan is to keep my retired hens as pets. I really don't see the difference between a hen that no longer lays regularly and other pets that don't provide anything other than companionship. And at least the chickens will still be able to turn over my garden soil for me. My dogs can't even do that much!
We'll worry about how to add more chickens for egg production when that time comes. We're lucky to have a few acres to work with so we can always expand the run, do another coop and run, etc.
I also cull older hens, sell or stew, don't have the money to feed or the space to keep non-productive birds....
......and all extra cockerels go on the grill by 13-16 weeks for that crispy skin then bones go to stock.