@EggSighted4Life has given a very good and expansive answer. The simple one is that there is no way to guarantee longevity in any creature including ourselves, no matter how much we wish it.
Chickens are prone to a myriad of ailments and diseases as well as being prey to countless different predators. We all do what we can to keep them healthy but there are no magic formulas. 5 years is a good age, but of course chickens can live longer and some of them will, but quite a few die younger. Some types of chickens have a better chance of living longer than others.... red sex links are pretty much bottom of the scale due to their high production. Heritage breeds that have less intensive production and more natural instincts like broodiness may live longer. Bantams probably have a better chance of living longer than large fowl.
Having worm egg counts done from faecal samples is certainly a good way of monitoring their parasitic load and only giving them medication if/when they need it. Fermenting their feed can promote a healthy digestive tract and therefore helpful. Giving them some animal protein occasionally can be beneficial. Free ranging them helps to stimulate them mentally and physically and allows them to self medicate on herbs etc, but comes at a risk of predation, so the benefits have to be weighed against the risk. If free range is not an option, then giving them access to greens and fruits and veg is better than a vitamin supplement but the latter can be useful to give them a boost occasionally.