If you are fighting in a war, going in and thinking its going to be a walk over is the wrong way to be thinking. That was the US in Vietnam. They are not trained in jungle warfare, you would have been better off with Ghurkhas on your side for that one.
When the US helped those in Afghanistan fight the Russians who wanted control of Afghanistan, why didn't the war machine learn from the Russian's mistake because they didn't as they went in there years later.
Early wars were about control over land and religion, later wars have always been able a commodity or drugs (funny that the US made deals with local war lords and in return they could continue sending their drugs to the US, not the first time something like that happened)