יוֹדוּ לַה’ חַסְדּוֹ; וְנִפְלְאוֹתָיו, לִבְנֵי אָדָם. כִּי-הִשְׂבִּיעַ, נֶפֶשׁ שֹׁקֵקָה; וְנֶפֶשׁ רְעֵבָה, מִלֵּא-טוֹב
"Let them give thanks to Hashem for His mercy, and for His wonders to the children of men! For He has satisfied the longing soul, and the hungry soul He has filled with good."(Tehillim 107:8,9)
If you look in this perek of Tehillim (107) you'll see the words "יוֹדוּ לַה’ חַסְדּוֹ; וְנִפְלְאוֹתָיו, לִבְנֵי אָדָם" mentioned a total of four times. The Gemara in Brachos (54b) explains that if you look closer you'll see that by each of the four times mentioned, there is also a mention of the four situations in which one is required to bentch gomel; crossing the desert, crossing the sea, recovering from illness, and being freed from jail. The Gemara says that this is the source for the times we are obligated to bentch gomel; to thank the Borei Olam for getting us out of a "sticky" situation through His abundant chesed.