The Quetta Shura is the Afghan Taliban leadership ousted in late 2001. It has existed in Pakistan since then, although several members have been captured. Why are they allowed to remain in Pakistan?
It's a somewhat complicated question, the answer is dual - based in (1) Afghan-Pakistan relations and (2) Afghan-Pakistan-India trilateral dynamic.
For #1, Pakistan and Afghanistan are at odds geopolitically, for a while. As explained in "The Diplomat"'s article "The Tangled History of the Afghanistan-India-Pakistan Triangle" ("Diplomat" is Asia-Pacific geopolitical analysis source):
This Afghan policy was very much influenced by “Pashtunistanism,” driven by idealistic and principled causes (i.e. supporting Pashtuns and Balochs’ right to self-determination, not recognizing the Durand line, and most of all continuing to claim as Afghan land territory lost in the 1893 Durand agreement, parts of today’s Khyber Pakhtunkhwa and Balochistan provinces in Pakistan). Due to this policy, Kabul was even led to give sanctuaries to those Baloch and Pashtun nationalists and separatists who wanted separation from Pakistan. Later, Pakistan did the same when the young leaders of the Islamic movement of Afghanistan, such as Gulbuddin Hekmatyar, Ahmad Shah Massoud, Burhanuddin Rabbani and others, went to Pakistan to get training.
So, both countries have a history and tactics of harbouring armed opposition of another country.
For more recent, Ankit Panda and Prashanth Parameswaran (of "The Diplomat" as well), have explained this indirectly on their recent podcast/article "Will Trump's Lash-Out Against Pakistan Succeed Where Other US Presidents Failed?"
... Tehrik-i-Taliban Pakistan (TTP) chief Mullah Fazlullah and militant leaders Mangal Bagh and Omar Khalid Khurasani, who are believed to be hiding in eastern Afghanistan
For #2, Afghanistan is considered to be a possible threat due to risk of its alignment with India, Pakistan's main geopolitical rival and threat (see that same linked article for history of the trilateral relationship).
As such, Pakistan is happy to weaken Afghan government, to make it less of an asset for India.
After the U.S. toppled the Taliban government, Hamid Karzai became Afghanistan’s new president. During this whole period, from 2001 to 2014, Afghanistan-Pakistan relations moved toward chaos rather than harmony. Generally Kabul’s Indo-Pak policy was very much pro-India. This habit was influenced by the fact that both countries had provided sanctuaries to the groups opposing each other’s government in the Cold War period. This affected strategic mindsets in both Afghanistan and Pakistan.
These Cold War-type fears and nightmares were relived in the post-2001 period. Pakistan blamed Kabul, for (along with Indian intelligence agency RAW) destabilizing Balochistan, the Federally Administered Tribal Areas (FATA), and other Pakistani territories. Afghanistan, on the other hand, claimed that Pakistan provides sanctuaries to ousted Taliban and supports them. Therefore, another proxy war started between India-Afghanistan-Pakistan in the Af-Pak region during the Karzai era, and continues today. (For more information about the proxy war in Afghanistan see William Dalrymple’s essay “A Deadly Triangle: Afghanistan, Pakistan and India.”)