With over 60 batteries to take care of I do my best to treat them nicely.
Started using BatteryMINDers and Canadus desulfators a long time ago, later also PulseTech products.
Some batteries (Optima Group 31 and normal car size, four each) were constantly on maintainers mentioned above and lasted over 20 years. Well, they started acting up when no longer plugged in, but were charged by solar chargers (still with desulfation).
My '10
M6040 battery is still going strong, rarely charged other than by using the tractor, but has a permanently installed Canadus. The '13
L3800 gets treated to desulfation every now and then, when I remember to put a Canadus on it.
Basically, each vehicle/trailer/battery is a bit different, and treated differently, but I think the key is (as mentioned by others above) to use
quality maintainers.
I've also found regulated 10W solar panels that seems to work very well. Some batteries are constantly on one of the six I have, others more occasionally, just like with the maintainers.
I don't remember having a single battery lasting less than five years, but the majority makes it past 10. Some are inside for the most part, the majority are outside.