They fail because of high current loads across the contacts that cause arcing, when switching from generator power to shore power, or when switching from shore power to generator power. The arcing damages the contact points by removing contract material and depositing carbon.
The loss of contact material and carbon build up increases contact resistance that in turn increases heat. That process continues until the current can no longer pass across the contacts at a level required in the circuit(s) the relay or solenoid controls.
The items with the highest start up current requirements are AC units, Refrigerators / freezers, heat pumps and motors.
I have made it a priority to turn off the AC unit(s), set the refrigerator to LP and turn off the furnace(s) before disconnecting from shore power or starting or stopping the generator. Once the transfer circuit has set its self to the proper state to supply power from the generator or shore power, you can turn things back on. The contact points are closed, so there is no arc.
Happy contacts = happy relays and solenoids.
Relays and solenoids do fail from time to time from actuator coil failure, but that is rare.
Save money in the long run, fewer parts, less labor time and that equals more money for fuel and fun.
I made money over the years replacing parts!! So over time replacing current carrying parts with one rated at a higher current rating will payoff in the long run, but one must remain diligent to reap the maximum reward.
Wire, transfer switches (relays and solenoids) and diodes top the list.