"I am going to do a longish ELI 5, so bear with me. I will link Wiki pages for you to start off your search while I will refer more solid sources at the end of the post.
Firstly, there is no monolithic entity called the Taliban. You have two separate entities we all know as the Taliban.
The Taliban - These are the Afghani Taliban. To give you a quick background into the Taliban (important to understand why they do what they do), the Taliban always existed in Afghanistan. They were literally a roving band of preachers operating out of the Southern parts of Afghanistan. The Soviets invaded Afghanistan and three countries via their secret service agencies created, funded, armed and trained the resistance movement we loosely call the Mujahideen. The parties involved were the USA (CIA), Saudi Arabia (GID) who did all the funding and arming. The Pakistanis (ISI) set up training camps, recruited volunteers across Pakistan and sent them across the border. All the funding from USA and KSA was routed via the ISI who alone decided which groups would live and which groups would die.
Without going into too much detail in this conflict, and in true ELI5 style, this resistance was soon split on many different political axes.
Northern Alliance (I like to call them the good guys - their leader is somebody who is a very inspiring figure).Ahamad Shah Massoud lead something called the Northern Alliance. This was a group that was more Shia in nature and owed allegiance to Iran and was also funded and aided by India (Pakistan's mortal enemy). The ISI obviously decided the NA couldn't be trusted and did their best to kill this movement (their leader mostly was assassinated by an ISI assasin / plot, though we never will know for sure).
The dark side here was The Hezb Islami lead by Gulbuddin Hekmatiyar. This group owed its allegiances to Pakistan and KSA and got the lions share of the funding and troops.
BY the time the war ended, the NA was though being the smaller force, kicking Hekmatiyar's arse all over town, and he was also too unstable (like killing 10k civilians in Kabul level mental), and the ISI+GID decided to drop him.
Enter the Taliban.
The ISI+GID combo needed somebody who they thought was pliant (ha, they sure learnt this lesson the hard way) and followed their ideology to counter Massoud and his Northern Alliance. So they hit on this rag tag bunch of preachers, armed them to their teeth - The ISI opened up a full armory in a place called Spin Boldak . The Saudi's funded them to the hilt (tanks, fighter planes, helicopters, the works) and the Taliban proceeded to crush the Northern Alliance, chasing them into their holdfasts - think of something like Helms Deep, where thanks to terrain and brilliant guerilla warfare by Massoud (the Lion of Panjshir), the Talin couldn't touch them.
Now, we move onto the Taliban and their ideological differences and why the Afghani Talib were so violent and intolerant.
You have many schools of thought in Sunni Islam, but we will restrict ourselves to,
Salafi / Wahabi movements - Broadly speaking this was a "purification" movement which felt that mainstream Islam had become too unislamic and corrupt. This is the school of thought the Al Saud family of Saudi Arabia exports all over the world (And responsible for a lot of terrorism as well to boot).
Deobandi Movement - Here is a thought that felt even the Salafi / Wahabi thought was weak and unIslamic and wants an even greater, more pure version of Islam.
Marxism as a thought was a rejection of capitalist values / system right? Now imagine a "purer" form of Marxism which rejected Marxism as impure. That is literally what happened here.
Now throw in another variation into the mix - Pashtunwali , now this is not a religious ideology per se, but a cultural ideology, but one that has its roots amongst the Pashtun people and goes back many centuries (literally a medieval way of thinking).
The Taliban, was a mixture of all these three and hence their extreme intolerance to anything they perceived or felt was unislamic.
Needless to say, the GID and ISI very soon lost control of the Taliban (who not very politely asked them to fuck off), sheltered Osama and the rest is as they say...history.
Now, who the Talban killing children and women in schools and markets?
They are the Tehrik-i-Taliban . They formed around 2002, 2003. They initially formed as a loose alliance of tribes in the Federally Administered Tribal Areas- FATA . By 2007, they became more or less a single entity under the leadership of, Baitullah Mehsud .
It is now important to understand what this FATA area is all about.
It has since the time of the Brits, along with the rest of Afghanistan been considered an ungovernable area and has nominally been under the Pakistani govt, but the Pakistani govt for the most part, never even bothered with direct governance.
This area is occupied by fiercely independant, martial, very warlike peoples who follow the code of the Pashtunwali and resist any attempt at being brought under any form of central government. The only modern empire to conquer it and subjugate this land was Maharaja Ranjit Singh an Absolutely kick ass Sikh Emperor and general.
During the Soviet War, the ISI very cunningly (and tragically for them, with extreme short sight) declared a sort of a truce with these groups, armed them, funded them and sent them to do battle with the Soviet Union. By the time the late 90's rolled around, these groups were very heavily armed, highly experienced and fought on difficult terrain which made any offensive against them very difficult to execute.
After the US invasion, the schism was ripped wide open - the Afghani resistance (or insurgents if you see them as that) used the FATA as the Vietnamese used Cambodia and Laos - a place of refuge, and to get away from US attacks as US troops couldn't enter FATA as it was Pakistani soil.
This was extremely frustrating for US planners, they would launch attack after attack, but the resistance would simply slip across the Durand Line , rest and come back and hit US troops.
The US demanded that Pakistan end this menace, and thus began a fratricidal war - The Pakistani army mobilised against these groups in the FATA in 2004 , and it was a dirty, no holds barred war.
Pakistan held and holds the advantage in conventional forces, but the Tribes, as I explained were veterans of a decade long war against the Soviet Union, they held mountainous terrain and really punished the Pakistani Army. Frustrated, the Pakistani army started taking it out on the civilians in the FATA (As in any COIN type war). Conventionally, both sides hit a wall and stalemate ensured. Multiple peace treaties have been signed, but the reality is, they are both in a state of war.
Finally we now reach your question, why do the TiTP kill civilians?
DISCLAIMER - I DO NOT SUPPORT THESE ACTS, and MERELY trying to explain why they are doing what they are doing.
In one simple word...Nyaw aw Badal  . It literally means Justice and Revenge - it is the Pashtun code of 2 eyes for an eye. In the Waziriztan war, the Pakistani army has killed innocents, children, women and this conflicts with many codes the tribes in FATA hold, chief amongst these,
Respect, Pride and Honour - When a Pakistani unit kills a child or woman in the FATA, the tribes see their personal pride and honour taking a beating.
Naamus - Protection of Women, now add in the above two elements of Pashtunwali code and you get a bloody, violent endless cycle of violence.
When the TiTP killed all those innocent kids in a military school in Peshawar, it was a message being sent to the ISI and Pakistani military (and Pakistani people) - You fuck with us, with our kids, we will fuck right back at you. If you kill our kids, we will kill your kids right back. When they bomb markets, the message is the exact same.
The TiTP is all about revenge for the war on Waziristan. The message is simple, Pakistan should withdraw their troops and let status quo remain unchallenged. If not, for every kid you kill, we will reach into your cities and kill your kids.
It is nasty, it is horrible, but in the eyes of the tribesmen, justified.
Primary sources -
Ghost Wars: The Secret History of the CIA, Afghanistan and Bin Laden by Steve Coll
Taliban: Islam, Oil and the New Great Game in Central Asia by Ahmed Rashid
Waging War in Waziristan: The British Struggle in the Land of Bin Laden, 1849-1947 by Andrew M. Roe. This will give you a solid idea of the nature of the warring tribes.
The Pashtun Question by Abubakr Siddiqque"
I hope that was enlightening. Here is the link to the orginal comment if you would like to read the discussion this explanation spawned:
And remember, as I hope this did remind you, that there is always two sides of every story, and that to understand the story you must keep in mind the cultural context in which they occur... and that the conquerors usually tell the tale.
“How can you have a war on terrorism when war itself is terrorism?”
― Howard Zinn