If it helps, think of proof-of-work as a game of tug-of-war. The strength of each side comes from their combined body weight as an analogy for hashrate.
On one side you have Team Honest, and on the other you have Team Attacker. Every new block is like one pull on the rope. If Team Honest has 60% of the total body weight and Team Attacker has 40%, then on average 60% of the pulls go to Honest and 40% to the Attacker. If the attacker has 49% of the body weight, it’s nearly even. At 50% or more, the attacker is guaranteed to eventually drag the rope to their side.
Your transaction becomes safer the more Team Honest has pulled the rope toward their side before you consider it final. This is what waiting for z confirmations really means. With each confirmation, the attacker falls further behind, and the chance they will ever drag the rope back drops.
But as the attacker’s body weight approaches half of the total, the advantage of extra pulls for Team Honest shrinks dramatically. At 40% weight, a lead