Try to launch the hand by exploding back the contrary shoulder.
Jonander is absolutely right, I believe. Adding some detail:
Looking at the gifs you posted, you mean 'snap' as in Mike Tyson's sense of 'snap' in a punch: Pulling the opposite shoulder back (which, for Tyson, means even pulling his opposite hand off his guard) at the same time your punch travels out.
This puts both more bodyweight and a little bonus speed behind the punch. By the time your punch is extended to the target, your upper body is twisted and transferring much more power than a normal punch would. This is what makes Tyson's and McGregors' punches push through so powerfully.
McGregor executes it standing upright, so just drive off your back leg for max power.
As for Tyson, his crazy strength requires a whole new level of technique. His most powerful punches came after slipping to one side (bending forward and sideways at the waist) while dashing in, landing heavy on his front foot, foot turned in towards the opponent. From this position you can bounce/drive up off your front leg, twist your upper body back upright, twist the opposite shoulder back and nail incredibly hard hooks and uppercuts.
Mike put so much into these he'd often come off the canvas. A combination of two or three of these would have him bouncing, jumping around like a pogo of death.
As for other comments on pulling back the punch on impact: Yes, this is also called 'snap' and it is good technique, but I don't think it's the answer to "why do Tyson and McGregor smash through walls like in these Gifs".