It looks fairly complicated and there is probably more than one cause for those pops, but here's my understanding of it. Car engines usually ignite a mixture of air and fuel within closed cylinders to produce the driving force of the engine. Gas from the byproducts of this combustion of fuel are then expelled through the exhaust system. Modern cars use a fuel injector controlled by a computer to time the injection of fuel so that it mostly combusts within the engine, with little unburnt fuel reaching the exhaust.
When cars go pop, something has caused sufficient unburnt fuel to enter the exhaust system and be ignited (perhaps by contact with the hot exhaust system), causing that pop sound. Often called 'backfire', it is more of an 'afterfire'. In fact, sometimes flames will even be expelled from the exhaust pipe. It occurs when the engine is no longer providing acceleration (coasting, gear changes, braking).
Performance cars will have their engine computers tuned with varying air to fuel ratios or various timings of fuel injection to get the most performance potential out of the engine. This sometimes allows more unburnt fuel into the exhaust as an unintended but perhaps not unwelcome side effect. Other people will choose to intentionally set up the their tuning to make this happen.
Another method is using antilag systems. In racing cars, these are used to keep the turbo spinning before it kicks in after acceleration, improving performance. They work by combusting more fuel between the engine stopping and the turbo kicking in, which as a by product induces the pop sound.
I'm sure there are other methods too. Before you get too eager to get your car popping, these modifications will often cause engine damage more sooner than normal driving conditions and are very likely to be illegal in your jurisdiction. Best to enjoy someone else's mistake if you find the pops appealing!
https://stxtuning.co.uk/pop-and-bang-remap/
https://www.carthrottle.com/news/heres-how-make-your-car-exhaust-spit-flames