Endophytes help with drought tolerance and disease resistance. Their name comes from endo meaning inside and phyte meaning plant, this is where they spend most of their lives. Once their plant partner dies they revert to a saprotrophic lifestyle and reproduce, often on rotten logs on the forest floor where their spores are more likely to meet up with young rainforest seedlings in need of fungal partners.
Many of the Discomycetes that we used to think were wood rotters are actually endophytes reproducing like this colourful and hairy Cookeina tricholoma❣️

Cookeina tricholoma an endophytic tropical discomycete (SJM McMullan-Fisher CC-By-SA).