Feet of Clay: Book 3 in the The Watch arc.
The Watch - Great whodunit/conspiracy stories that feature the Ankh-Morpork City Watch, the city's police force, Lord Vetinari, the cities patrician, and a variety of cameos from the other arcs. This story arc is arguably one of the most popular, largely due to the strong character development.
'Sorry?' said Carrot. If it's just a thing, how can it commit murder? A sword is a thing' - he drew his own sword; it made an almost silken sound - 'and of course you can't blame a sword if someone thrust it at you, sir.'
For Commander Vimes, Head of Ankh-Morpork City Watch, life consists of troubling times, linked together by…well, more troubling times. Right now, it’s the latter. There’s a werewolf with pre-lunar tension in the city, and a dwarf with attitude and a golem who’s begun to think for itself, but that’s just ordinary trouble. The real problem is more puzzling - people are being murdered, but there's no trace of anything alive having been at the crime scene. So Vimes not only has to find out whodunit, but howdunit too. He's not even sure what they dun. But soon as he knows what the questions are, he's going to want some answers.
Twelve of the city golems, clay creatures forced to obey the written instructions placed inside their heads, decide to create a "king" golem. They fashion a golem from their own clay and place in his head instructions that would fulfill their hopes: "Bring peace to the world", "Treat everyone fairly" and so on. They enroll the help of a priest and dwarf bread baker to write the sacred instructions and bake the clay, respectively; Meshugah, the "king" golem, is initially sent to work in a candle factory, and later murders the priest and baker who took part in his creation.
Around the same time, a cabal of Ankh-Morpork's guild leaders seeks to gradually depose the Patrician, replace him with Nobby Nobbs as the new king and rule the city through him.
To implement this, the cabal orders the golems' newly made king, Meshugah, to make poisoned candles and have them delivered to the palace. Vetinari is successfully poisoned, making him severely ill. Meshugah, however, is "overloaded" by all the different instructions his creators gave him, and goes "mad": he starts overworking and, when he finishes raw materials, he rampages through the city.
At this point the City Watch steps in trying to solve the murders and the poisoning of Lord Vetinari. With the assistance of their new forensics expert dwarf Cheery Littlebottom, Commander Vimes and Captain Carrot slowly unravel the mystery.
Carrot and Dorfl, one of the golems, fight and defeat the golem king at the candlestick factory. Afterwards, Vimes confronts the city's chief heraldry expert, a vampire, who instigated the whole affair. Dorfl arrests him despite tenuous evidence and Vimes burns down all the heraldic record as retribution against the "elite" and "noble" plotters, who had happily and self-righteously sacrificed the lives of several "commoners" in the pursuit of their scheme.
In the end, Vetinari has recovered completely, Dorfl is sworn in as a Watchman, Vimes gets a pay rise, and the Watch House gets a new dartboard. Vetinari reveals to his assistant, Drumknott, that he had known of the plot for some time already. Vimes' rash actions in the pursuit of truth had considerably scared the city elite, which is precisely why Vetinari had let him continue: so that the plotters would know just how much worse off they'd be if Vetinari died.