Depends on the breed--leghorns generally burn out in a year or two while some of the heavier breeds keep pumping them out a couple or 3 times a week until they are 4 or 5. I currently have a 5-year old Black Star that lays once a week and 2 4-year old araucanas that lay every other day or so. When I was concerned about max egg production with a small flock I'd get rid of them in before their 3rd molt.
There are a couple of other threads on here about laying and age you can check. They usually succumb to predators or disease or plan old age at 5-6 years in my experience but if you're really vigilant they'll live longer.
My Rhodies are about three years old and still pumping out eggs 6 days a week. I had a local poultry expert feel one of my gals pelvis and he claimed she was just about to go off lay - that was TWO months ago! Granted, we're seeing a quality lapse - one of them lays very rough (like fine grade sandpaper) shelled eggs and the other one lays eggs with bumps on them.