I've got a handful of dwarfs that won't stop throwing tantrums, breaking things, going insane, and spreading their malcontentness. I killed the first few in an attempt to put an end to their madness, but I'm thinking that escalated the problem. What can I do to get them back to being contributors to dwarven society?
The short answer is you need a justice system.
A jail is a room used by the justice system within your dwarven community, also known as a prison. They are designated from a constructed restraint, by querying the restraint, designating it as a room, and then setting it to be used for justice.
The jail is only one part of the equation, you'll also need a Sheriff or Fortress Guard to actually carry out the policing.
Policing your dwarves will cause them to get locked up when they do bad things. This is an alternative to killing them as that can lead to bad thoughts amongst other dwarves. Its important to note that if your prison isn't nice enough, it can also lead to bad thoughts and make things worse instead of better.
They're going to need a Bed, Food and Alcohol to stay alive. The better the quality the better for the dwarf. A table and chair also go a long way. Finally, the quality of the restraint also affects the mood of the dwarf in question.
Its important that you always have room in your prison for new dwarves. If you don't, illegal activities will be punished by the hammerer which can lead to bad thoughts and death.