Deto is when the end gases in the squish area ignite more like an explosion than a typical combustion and cause pitting in the outer zone of the piston and the head. This happens due to heat and pressure (like a diesel engine w/o spark ignition). So anything that reduces engine heat helps prevent detonation. The most common cause is too much spark advance which greatly increases peak pressure. Another thing that can increase peak pressure is too much turbulence due to too fast a squish velocity (due to too little squish clearance). With excess turbulence the combustion speeds up to have an early peak pressure which is extra high due to being closer to TDC (such as at 7 degrees aftter TDC instead of the normal 12 degrees). The end gases are more volatile and with excess pressure can ignite more easily.
It’s All About Balance
Factors increasing combustion speed are small carb size, high compression, high squish velocity, and high volatile fuel. They all work together as a team. If there is detonation then you need to change one or more of these factors. Putting on a thicker head gasket reduces the squish velocity and decreases engine compression. Switching to a high octane race fuel is a common option because those fuels are usually less volatile and help resist detonation. Switching to a bigger carb decreases the air velocity in the carb which doesn’t atomize the fuel as much (leaving it less volatile). So tuners need to adjust these factors for their particular engine for best power w/o detonation. No single factor “causes detonation”.