So far this year ISIL (Islamic State in Iraq and the Levant) has lost about 20 percent of its territory in Syria and Iraq. As bad as that is the most damaging of this territory loss is the fact that it includes the last reliable access to the outside world. That was the Turkish border, which Turkey cleared ISIL out of since Turkish troops entered Syria in August. The Turks have not occupied a lot of territory but they have seized control of all the roads crossing the border and instated strict border controls that have temporarily put Turkish smugglers out of business, at least those not willing to work closely with the Turkish troops. Smugglers have been a tradition in the region for centuries, ever since more national states established rules regarding what could legally cross their borders (with or without paying tolls). All the nations in the region would use the smugglers, who were expert at getting things across guarded borders. Until ISIL began carrying out expensive (to the lucrative tourist trade) attacks in Turkey the Turks saw no reason to shut down the entire Syrian border. But once ISIL made the Turks an active enemy the smugglers could no longer do business with the Syrian rebels that still, technically, included ISIL. By early 2016 the Turks agreed that ISIL must be shut down whatever the cost. The closed the last useful supply line for ISIL. All the other Syrian borders (with Lebanon, Israel, Jordan and Iraq) are now controlled by governments who are extremely hostile to ISIL. This denies ISIL a way to get new recruits in and people (like families of senior ISIL members and members being sent abroad to help with recruiting, fund raising and planning overseas attacks) out. These borders are not completely sealed but they are now very expensive to cross and large shipments either way are all monitored. This hurts ISIL in terms of getting ammunition, weapons and, most importantly, equipment and supplies needed to run their Islamic State.
In early 2016 the main reason ISIL was still active and in control of large chunks of Iraq and Syria after two years was because they paid attention to logistics (getting supplies) and finance (finding ways to pay for the supplies.) ISIL succeeded because they had plenty of qualified and experienced administrators willing to get the job done. This came about because for centuries the Sunni minority in what is now Iraq ran the largely Shia area. For most of the last four centuries the area was part of the Turkish Ottoman Empire. The Sunni Turks had taken what is now modern Iraq from Shia Iran and did not trust the Shia Arabs to run things. The Sunni Arab minority in the area was another matter as this group was always better educated and more prosperous than the Shias and tended to run Baghdad and areas to the south no matter what empire was in charge. So the Turks had these Sunni Arabs administer this part of their empire. When the Ottoman Empire fell in 1918 the British took over, looked around and decided to leave the Sunni Arabs in charge. In 1932 Iraq became independent as a constitutional monarchy but the king, most army officers and senior officials were Sunni Arabs and largely controlled the new Iraq.
The British had to re-occupy Iraq during World War II because the Sunni Arab government tried to ally itself with the Nazis. At the time many Arabs admired Nazism (and many still do). The Brits again conquered the country, gathered together another bunch of Sunni Arab notables and told them they could run things if they stayed away from the Nazis. That 1941 deal lasted until the 1958 when the Sunni Arab politicians and generals decided that this constitutional democracy stuff wasn’t working for them. The royal family was massacred and parliament purged of “disloyal” elements. The Sunni Arabs were now firmly in charge, via a series of dictators, until Saddam Hussein was deposed in 2003. Despite the subsequent elections many in Iraq, not just the Sunni Arabs, believed a dictatorship (with them running it) would be the best solution for the nation's ills. Some Iraqis (mostly Sunni Arabs but even a few Shia Arabs) still admire Saddam and consider his blood-soaked reign a "golden age." Few Iraqi Kurds (who are Sunni) or Shia Iraqis agree with that.
When the American and British removed the Sunnis Arabs from power in 2003 many of the Sunni Arabs still believed they were born to rule and enjoy 80 percent of the oil wealth. That was a sweet deal since Sunni Arabs were only 20 percent of the population while Shia Arbs were 60 percent and other minorities (mostly Kurds) the rest. Al Qaeda came in after 2003 and added Islamic radical terrorists to all those terrorists that the Sunni Arab nationalists and Saddam supporters had recruited to help them put Sunnis back in charge. This backfired, as al Qaeda represented a form of political action that the post–World War II Sunni Arabs had abandoned and even gone to war with. Islamic radicalism was never all that popular in Iraq. But now, in the name of restoring Sunni rule Islamic terrorists were allowed to do as they pleased. This led to all non-Sunni Arabs becoming "legitimate targets" that could all be killed or driven out of the country. Such threats are nothing new and have been getting worse for over a century. Thus the old (founded in 2006) Islamic State of Iraq (which eventually became ISIL in 2013) is still a coalition of most of the Sunni Islamic terror groups operating in Iraq who want the Sunni Arab minority back in power at any cost. That effort was crushed by 2008 but the corrupt Shia government forced the Americans out in 2011 and, ignoring U.S. advice, froze out the Sunni Arabs and drove many right back to the Islamic terrorist groups.
What ISIL had that no other group had was access to thousands of trained and experienced Sunni Arab military officers, civil servants and technical specialists. This was long known but was confirmed in early 2015 when an American commando raid into ISIL territory captured vast quantities of ISIL records (mostly on PC hard drives). An analysis of these documents clearly showed the presence of the Saddam’s henchmen who had set up a ruthless but efficient bureaucracy. Because ISIL was even less obliged to obey rules than Saddam they had a department of loot, which raised large amounts of money by selling slaves, oil and any valuable loot (like antiquities) ISIL captured. All that fund raising and administrative skill was not enough and now ISIL has most of the world united to destroy it.