How do the demon traps keep a demon from escaping them? If a demon is such a bad creature why can't they destroy them inside the trap?
How do the Devil's Traps keep a demon from escaping?
The Devil's Traps used in the show are based on pentacles from the Greater Key of Solomon, a real occultist manuscript from the 14th or 15th century. However, the writers take a few liberties with them: in the original manuscript, the pentacles aren't "traps" per se; they were more like talismans, and each conferred a different sort of power against a different sort of demon.
For example, the most commonly-seen Devil's Trap, such as the one on the floor of Bobby's panic room:
This most closely resembles the First Pentacle of Mercury:
According to the Key of Solomon, this pentacle invokes spirits of Earth:
The First Pentacle of Mercury. It serveth to invoke the Spirits who are under the Firmament.
Other pentacles do things like invoke earthquakes, act as love charms, render immunity in battle, and summon spirits of various orders. None of them, from what I can tell, exclusively bind a spirit, although some (such as the Third Pentacle of Jupiter, pictured below) will compel a spirit to obey the summoner.
The Third Pentacle of Jupiter. This defendeth and protecteth those who invoke and cause the Spirits to come. When they appear show unto them this Pentacle, and immediately they will obey.
At least one, the Fifth Pentacle of Mars, is said to be "terrible to demons":
The Fifth Pentacle of Mars. Write thou this Pentacle upon virgin parchment or paper, because it is terrible unto the Demons, and at its sight and aspect they will obey thee, for they cannot resist its presence.
Okay, but what do they actually do?
The short version: draw the pentacle on the floor or ceiling, and once a demon steps within the boundaries of the circle they cannot get out.
Materials The trap can be drawn on any surface: floors and ceilings of various materials, the trunk of the Impala, carpets, light fixtures, the underside of a water tower, the floor of a barn. As long as you can draw the trap, it doesn't matter.
It also doesn't seem to matter what you draw the trap with. We frequently see the Brothers using spray paint, but the substance doesn't seem to matter; we see them made with chalk, criss-crossed metal chains, railway lines, blueberry vodka, a light fixture, and invisible ink.
Position Per Thaddeus's answer to a related question, it appears that the trap must be either above or below the demon, not off to the side. However, the trap doesn't necessarily have to be visible; the Brothers have frequently tricked demons by hiding the traps under carpets, and they remain effective. I can't recall off the top of my head if the blueberry vodka and black light examples, above, were effective before they were revealed.
Shape The level of detail in the Trap doesn't seem to matter very much. The one on Bobby's ceiling is quite detailed, but the Brothers often draw their traps with spray paint (much less granularity of detail) and they don't seem to be any less effective.
The only thing that seems to be required is the pentagram (or a heptagram in the case of Bobby's trap) in a circle; the massive Devil's Trap revealed in "All Hell Breaks Loose: Part 2", the one made with railway lines, appears to be nothing more than this.
It's possible that there's a connection between the design of the Trap and it's effectiveness, but this has never been made explicit.
Effect While a demon is inside the circle, they lose their power of telekinesis. However, they are still able to use magic; in one episode, Meg uses a spell to break a trap she's caught in.
The demon also cannot leave the circle, or be forced out of it. I can't recall the episode, but on at least one occasion we've seen a demon be flung into what acts like a solid barrier at the boundary of the circle.
Limitations If the integrity of the circle is compromised, it stops working; basically if there's the tiniest break in the circle, the demon is free. We've seen demons crack the surface the trap is painted on, scrape some paint away, or just dissolve some of the paint with water. It doesn't have to be a big break, but just enough to that the two ends of the circle don't meet any more.
Additionally, exceptionally powerful demons seem able to eventually counteract the effects of a Devil's Trap, though it's not known how they do this. And when I say "exceptionally powerful", I basically mean Cain; he's the only one we've seen who can do it, and it may be an ability unique to him; Crowley was stuck in a Devil's Trap for months when he was a "guest" of the bunker, and he never seemed even remotely able to escape.
Why don't they destroy a demon inside a Devil's Trap?
They frequently do. That was actually the original point to introducing them; it's a lot easier to exorcise (and, later, to stab) a demon when you've cut off their supernatural1 powers and confined them to a small space.
Early in the show, there was usually a good reason for the Brothers to have a demon in a trap and not destroy them. A notable example is season 3's "Sin City", where Dean has a demon trapped but is unable to do anything else because
- He doesn't have Ruby's demon-killing knife
- He doesn't have the colt
- He can't remember the words to the exorcism spell
Even more recently, when they're as likely to try to bargain with a demon as kill it (see Crowley, constantly), they still try this trick; this was the initial plan to kill Cain in season 10's "The Executioner's Song":
1 See what I did there?