One says Birchas HaGomel on surviving a dangerous situation, particularly one who survives prison, a dangerous illness, a trip over the ocean, or a trip through the desert (SA OC 219; see §9-10 there regarding if this list is exhaustive).
What if one survives multiple of these situations before having a chance to say HaGomel?
I see two possible types of situations in which this could apply: when they overlap (ex. one who becomes terminally ill in prison, or one who is terminally ill and goes overseas for treatment), or when they are in immediate succession without a chance to say the beracha in between (ex. one who becomes terminally ill immediately upon completing his trip/imprisonment).
Does one say HaGomel once or twice in these kinds of situations?
On the one hand, each one is a miracle in and of itself, and so even if they overlap, one should say on each one. On the other hand, maybe it’s counted as one miracle (one act of saving) if they happen at once, and therefore require one beracha, but if they happen sequentially, it’s two miracles and would require two berachos. On the third hand, maybe one beracha can satisfy both, similar to how making a beracha on one food can satisfy all foods requiring that beracha.