Obviously nothing stays around forever. But there is a big difference between a trendy app that everyone uses for a couple years and then stops, and Facebook, which many people don't use on a daily basis but still keep it around because its usefulness outweighs the effort required to keep your account. I have friends who have deleted their Facebook accounts, only to come back a month later with a very basic account just because they need to keep in touch with some circle of friends that they otherwise wouldn't be able to.
Not at all obvious to the investors who value these companies at tens and hundreds of billions of dollars. They don't expect them to dissapear in 5-10 years