There are four situations which might arise in a person's life that call for one to offer a mandatory individual שלמים offering called a Korban Todah. In absence of the Temple, the Rabbis have replaced the offering with a requirement (according to most) for one to publicly verbally acknowledge God's benevolent intervention in his personal fate. The source for the "Todah sacrificial offering" requirement is found in chapter 7 of our parasha.
The Talmud ( Berakhot 54) is very specific in declaring and detailing the four people who are to give Thanks thru the benediction of HaGomel once they are out of danger. These include one who has traversed the sea, passed thru the desert, recovered from an illness or having been released from prison. We will attempt to explain the nature of this danger they had been exposed to and how the Korban or blessing of thanks releases them completely from the peril.
Four Associated Dangers
Our sages teach that there are four dangers that can חס ושלום cause harm at certain times.The code names are עון, ישחית, אפו , חמתו - One of these times is at the start of the evening hours - hence our Sages have instituted the והוא רחום prayer to remove or mitigate this danger. These dangers also appear to be associated or are aroused to attach themselves to an individual who traverses into their territory. The Talmud (Shabbat 32) details what occurs spiritually for example when an individual is bedridden "it should appear in his eyes as if they brought him up to the scaffold to be judged."
The danger imposed upon the traverser of sea, desert, the bedridden and prisoner are of a spiritual nature of being judged. Freedom from these four situations is considered miraculous. The blessing that the Sages have established, - הגומל לחייבים טובות includes and recognizes that the escapee had been in the grasp of this spiritual peril and hence he refers to himself as "obligated" חייבים - ; or in the grasp of the negative force of חובה.
What Does the Blessing of Thanks Accomplish?
The second day of creation as recorded in Sefer Beresheet is absent of the word טוב ; The Zohar ( Intro Beresheet) explains that the spiritual force of day 2 is associated solely with Din or Judgement. Furthermore we are taught that גיהנם was created on that day. In order to sweeten these judgements the Creator on day 3 reintroduced the concept of טוב back into creation. This effectively neutralized the effects of judgement. The ideas surrounding Thanking can be found in the penultimate blessing of the Amida
הטוב שמך ולך נאה להודות
This blessing begins with Modim, a prayer of thanksgiving for the daily miracles; On Purim or Hanuka we are instructed to thank Hashem for saving us from a national danger with the על הניסים - Finally we see that the blessing is pervaded and ends with a request or acknowledgement of הטוב. This recalling of Hashem's goodness effectively sweetens up any judgement associated with being a benefactor of a miracle. As per the ruling in Shulhan Arukh - the blessing to be said is
הגומל לחייבים טובות שגמלני כל טוב
We detect here a recognition of the danger by calling the subject חייבים one in the grasp of חובה -
However, the reader and the congregation who respond האל שגמלך both ratify that טוב was and should continue to remain present. This recognition of טוב - goodness effectively mitigates one of these applicable dangers. Similar to Hashem's reintroduction of the טוב on day 3 to mitigate the Din or Judgements associated with day 2.
Making the Blessing in Front of Two Elders
Interestingly, Mar Zutra (Berakhot 54) rules that the public declaration of HaGomel must be said in front of two elders. As it is written "in the company of the elders he will be praised". Though interpreted to mean two scholars - I would add a somewhat novel thought. It appears from the words of our Rabbis that there will be a point in history where the judgments of any danger associated with the Satan will be nullified ( Sukka 52).
This will be an era closer to that state of Adam prior to the sin. At the inauguration of the Mishkan we are told by the Midrash (VR 20:10) that Nadav and Avihu would walk behind Moshe and Aharon saying "when will these two elders pass away (to usher in a new era) when we will become the new leaders. God told them "do not pride yourselves with tomorrow." They were under the assumption that the resting of the Shehina in the Ohel Mo'ed was an indication that any danger associated with the Satan was for all purposes nullified or at least immobilized.
I saw an explanation of God's response as cited in the Midrash in an essay from R. Pinhas Freedman ; that Hashem was in effect telling them that the time is not yet ripe ( for the new era). Hence the message of Mar Zutra is clear; those who are required to thank Hashem must do so specifically in front of two elders; this will serve as a testimony that the era of our Elders has not yet passed. And admittedly the danger still exists; for we have not yet passed to the new era where the powers of Satan will have become stymied. In the future if it is the will of Hashem we will enter an era without these dangers while being led by the likes of Nadav and Avihu.