That's the rub that strategists discuss at length.Warfare has been going on for some time. After the fighting slows or stops, It takes longer and you require more resources to root out any remaining opposition. And frankly, you can never get it all. Regardless, how do you maintain peace and control?
The US is often faulted for fighting a bunch of wars and then hanging around. But the deal isn't done after you've taken out the last of the resistance. For peace to last, someone has to be there to monitor things and take action, should a new group rise up and attempt to cause trouble.
This is where the debates start and never seem to stop. The responses in parentheses are mine.
1. How long do you stay? (It depends. Each situation is different.)
2. How much power is given to forces that remain? (Ideally, locals form their own governments, police their own people. Remaining forces advise. Unfortunately, it doesn't always happen that way. Again, each situation is different.)
3. What gives the US - or any other country for that matter - the right to invade another country? (Many times, assistance from a country is requested. Other times, when there is a breakdown in local government and people are suffering, countries go in. Natural disasters happen. Occasionally, when the actions of a country threaten the well being of surrounding states. For all these things, the UN is supposed to act, but they have turned into a bloated, poorly functioning bureaucracy. )
There is an expression that started sometime in the 1970s. "Boots on the ground." After the fighting stops, some conventional ground forces remain to transition a country back to a peaceful existence. Sarcasm aside, once fighting slows markedly or completely stops, things have to return to a peaceful state. Help is always needed. Political advice. Medical. Food. Training locals to police the peace, etc.
If you like history, the study of what happened in Europe after WWII finished is compelling. Japan too. Modern examples include Afghanistan. When the US finished in country operations, why are some troops still there?