Use the Extractor
Keys break more often than you might think, and there is actually a specific tool made for extracting broken keys from locks. Most people probably don’t have one of these laying around, though now is the time to use it if you do, but they can be purchased for just a few dollars online or at select hardware stores (call ahead to save yourself the trip in case they do not carry the tool).
To use the extractor, slide it into the keyway along the part of the key that engages the lock, also called the bitting. Once the extractor is in place, twist it slightly and pull. The goal is to use the small hook at the end of the tool to catch the teeth of the key. You might have to try a few times before it comes free, but with a little persistence, you should have your key out in no time.
In some situations, you may not need any extra tools at all. If your key breaks inside of a padlock or a car lockout with a removable cylinder, you can often slide the keysmith with nothing but your own strength and a little help from gravity. However, the addition of lubricant will still help expedite the process.
All you need to do is firmly hold your lock and tap it forcefully against the edge of a hard surface, being sure not to cover the keyhole. With a little effort, the key should slide out of the lock, at least enough to allow you to grab the end with your pliers or fingers and pull it the rest of the way out.
Hardware stores may not carry many locksmithing tools, but they are sure to have a wide selection of different hacksaw or jigsaw blades that will work just as well to help remove your broken key. Since they tend to come in packages containing multiple blades, you might want to check your garage or toolbox to see if you already have a few handy.
The method for using the saw blade is almost identical to that of the key extractor tool, but you will first have to break off the end of the blade in order to remove the thick portion containing the pin on one end, allowing it to fit into the lock. Also remember that if the serrations on the blade are at an angle, you want to make sure they are pointed back toward you when you insert it into the keyhole. This will allow them to grab the teeth of the key in the same way the hook on the end of the extractor tool would as you pull it out to remove the key.
This method of freeing your broken key from the door in which it is stuck leaves room for a little variation and is a good option if you do not have access to any specific tools or the time to run to your local hardware store. If you have a purse or bookbag with you, chances are you have just the tools you need.
This approach is all about technique. Find two objects small enough to slide into the keyway along either side of the key (the two sides that engage with the warding of the lock, not the smooth side or the side with the bitting). You can use two pieces of stiff wire, bobby pins, safety pins, or whatever you can find, though the objects should not be something of great value to you because they may be slightly bent in the process.