"Already explained, attacks work better when they gain the advantage of surprise." Attacks work almost ONLY if advantage of surprise:
Ardenne 1940 (for the Germans).
If not: Waterloo for Napoleon.
And if for what ever reason, the attacker lost the momemtum, attackers failled (battle of the Bulges for thr Germans) then are opened to counter offensive (1st battle of the Marne -Germans-, Moskow 1941 -Germans-).
Another aspect is when things go out of control, like the Egyptians in the Sinai. Plan was perfect however for political reasons Sadate was obliged to send his tanks out of the AA missile umbrella so played in Israelis hands...