I recently saw a few videos in which tyres exploded while being inflated. It caused the mechanic or whoever was pumping the tyre to be thrown to the ground. Does this happen frequently and what precautions can one take?
Tyres almost never explode during inflation. What you saw were freak incidents.
In theory, of course any rubber "vessel" can explode if inflated beyond its maximum design pressure. But it is highly unlikely.
The recommended tyre pressure for a passenger car ranges between 220kPa and 320kPa. Depending on size, maximum tyre pressure varies between 300kPa and 400kPa, with the burst-limit at three to four times those values - or at least 900kPa.
Air pumps at most service stations struggle to achieve even 600kPa. As such, it is practically impossible to pump a tyre till it explodes.