Like other miscalculations in history, Bin laden made a miscalcualtion on what an attack like 9/11 would do.
History is full of one side not being able to predict what the other side would do given a certain situation. Before World War One, Germany did not think Belgium would resist the invasion of thier territory, nor did they think that England would join the fight. They were wrong.
In World War Two, Japan thought a sneak attack on the US, followed by one decsisive fleet battle would force the US to seek terms. they were wrong.
Bin Laden saw the US withdraw from lebanon after the marines barrack attack. He saw the US leave Somalia after the "blackhawk down" incident. He saw zero response to the US Cole attack.
What he assumed was a strong enough attack on the US would lead either to a withdrawal from the area by the US, or a half assed response. What happened was neither. He did not get the result he wanted.
Bin Laden's goal was overthrow an replacement of the Saudi regime on the way to an eventual return of the old Ottoman Caliphate. All his actions were predicated on his attempt to have this happen.