Our Gurudev Sri Babuji Maharaj used to narrate a story. There were this group of people called Gunupudi Jangams. They didn't have any personal possessions and used to beg for a livelihood. Once they all met in a place and wanted to build houses for themselves. As they didn't have any money for buying bricks, cement etc. they looked around and found a field of banana trees. They found the banana trunks so round and shiny and thought they would make great pillars for the house. They cut the trees and constructed houses for each one of them with the banana trunks as pillars and the leaves as roof.
One of the Jangams wanted to know what is inside the banana trunk. He took a knife and started peeling the layers of the trunk one-by-one. Finally, there was nothing left except for himself. A short while later a huge gust of wind blew and all the houses made of banana trunks fell down. the Jangams were very sad and started crying. but the one Jangam that did the inquiry into the true nature of the banana trunk already knew that it wouldn't last long and he remained blissful as ever.
In Vedanta, there is a process of inquiry called "Neti Neti Vicharana" - meaning inquiry that rules out all the things that are not "I". The inquirer starts with all the worldly things he finds around him and rules each one of them out realizing "This is not I, this is not I." Then he realizes his own body, mind and intellect are also not himself. By such inquiry one realizes the true "I" or "Atma". Once he realizes that there is no fear or sorrow of losing the worldly things and he remains in his blissful state no matter what comes his way.
Thus, he attains the true state of a Sthita-Prajna as described in the Bhagavad Gita. No joy or sorrow can touch him as he realizes his oneness with the all-pervading almighty. Sri Gurudev used to give another example also for this kind of inquiry. He used to say, "You start peeling the layers of an onion to see what's really inside it. Once you peel of all the layers, there is nothing left except 'You'."