Afghanistan has long been a very politically unstable nation, with many tribal factions and border conflicts.
There are a group of hard line extremists who want to create a caliphate- a conservative, right wing, nationalist state that limits the hard won freedoms of the majority. They believe in control and subjugation through violence and oppression.
Those extremists are very wealthy and we’ll resourced from outside Afghanistan. It means they have better resources than the Afghani police and military. That external resourcing makes them incredibly powerful. They are supported because of Opium mainly. The Opium poppies provide a huge economy in narcotics trading.
Widespread destruction during the war, millions uprooted from their homes, foreign aid cuts, and losses of local spending by departed U.S.-led foreign troops are fueling an economic and humanitarian crisis that is likely to leave many destitute Afghans dependent on the narcotics trade for survival.
That dependence threatens to bring more instability as the Taliban, other armed groups, ethnic warlords, and corrupt public officials vie for drug profits and power.
They also control mining in mountainous areas and have rich individuals funding from Saudi, Iran and Pakistan. They have fundamentalist supporters outside Afghanistan- although no states openly support them.
The rest of their money is raised through taxes and local levies. Taking money from the already destitute.
In the past twenty years, the country has seen fledgling democracy emerging, but withdrawal of troops and foreign aid has left the path for rich, fundamentalist men with guns to take control. The swift withdrawal of troops has exacerbated the downfall and led to panic amongst the ordinary people and foreign nationals.