The fart is slowly released without you releasing it
The fart travels back into your back passage and comes out latter
Also, any doctor or hakeem here must suggest medicine/food to reduce the gas problem. I usually intend to recite Quran after Namaz but often the gas pressure don't allow me so.
I'm not sure but I heard that in hanafi fiqh if you break you wudu due to something involuntary whilst being the imam then youre menat to pull someone from behind to continue the salah whilst you do wudhu. But I have no idea how thats actually meant to happen, I desperately need to ask a scholar inshallah.
Also I desperately need more people to comment on this thread inshallah as I might be leading my first tarweeh this year and do not want to invalidate everyone elses salah behind me.
I heard that chewing your food properly helps a lot and trying to have a balance diet avoiding stuff like beans and brochily
but what do you do if you need to let of gas whilst leading others as a imam
Then you hold your nose as if to signal a nose bleed, pull the closest person behind you to the front, and then make for the bathroom.
As for the original question:
Gas is created by microbes within your bowels. There is a threshold that has to be reached before the body feels that it needs to release flatulence. It is a gradual increase so you cannot hold in flatulence forever (people normally cannot hold in gas for more than a day and a half).
ياايها الذين امنوا اذكروا الله ذكرا كثيرا
are you agreeing to "the fart travels back into your back passage and comes out latter", please vote on the poll