Is there a recommended number of years until it is replaced for safety reasons?
Yes they do wear out. The most common components in a PSU to fail are either the fan or the capacitors.
If either one of the parts fail it should be quite easy to tell you need to replace the PSU.
how often do you replace a PSU for good measure? (or on average)?
It depends on the PSU quality and how hard you run it. A good PSU often has at least a 7 year warranty, so that's probably a reasonable place to start estimating.
Of course, if you have no/almost no warranty cheapo PSU, you should probably get a good one ASAP.
There is no recommended years, but yes, PSUs do wear out as electricity changes chemical properties of the PSU parts and the solder corrodes. It all depends on a number of factors.
Adding on to this
PSUs do degrade. How severe the degradation, however, is all based upon the quality of the PSU. Degradation can cause the PSU to not output its rated wattage or efficiency.