Lockpicking is an art. You require a ceirtain level of intelligence, lots of patience, two steady hands and a makeshift or specific set of tools to even begin to learn it.
Tumbler or wafer locks (the types found on your front door, padlocks and cabinet locks, and with keys that have ridges) are by far, in my opinion the easiest locks to pick. Ward locks (such as those you find on garage doors with the classic keyhole shape, and with keys that have a shaped square of metal at the end) are harder to pick and generally require a set of skeleton keys.
PICKING TUMBLER LOCKS
Tumbler locks, through the nature by which they are produced have imperfections. These include positioning errors in the pins/wafers or the pin holes, a misaligned tumbler or misshapen parts. Lockpicking exploits these faults to allow a person with the correct tools to perform the actions that the key does, but without the key.
When positioned in the keyhole in a tumbler lock, the ridges along the key push spring loaded pins/wafers that lie between the tumbler (the rotating part of the lock) and the hull (the outside area around the tumbler) to the correct height to allow the tumbler to rotate inside the hull and trigger the unlocking mechanism.
In tumbler locks that use pins (front door, car doors) the point at which they are alligned by the key is determined in the following way. The pins along the depth of the lock are exactly the same size, but each pin is split in two parts(at different heights for each pin) at a point known as the 'break point'. When the break points of each pin are in line with the gap between the tumbler and the hull, the tumbler will turn freely. When the key turns the lock, the top half of the pin rests in the hull, and the bottom half of the pin (called the driver pin), the one that touches the key stays in the tumbler and turns with the key. Thats why you can't take your key out of the hole untill you've re-aligned it at the position you put the key in at (otherwise the pins in the hull would be trapped, and the pins in the tumbler would all fall out as you pulled the key out - as a result you'd have a useless lock where the tumbler would turn freely).
To pick a tumbler lock you need to put a rotating pressure on the tumbler (typically clockwise if you wish to open the lock), usually done with a long, thin, strong piece of metal (like a paperclip or hairclip, this tool is called the tension wrench in lockpicking). This movement must be strong enough to make the tumbler's pin-holes put friction on the hull pins, but light enough to allow the hull pins to move when pushed. This done, you use another tool (the lockpick itself) to gently push the driver pins untill the hull pins 'click' into the hull and are held there by the friction of the turned tumbler against it. This is called the binding effect. Aside from the small audio cue caused by the tumbler hitting the next hull pin, the driver pin will also stop pushing back against the pick (as the spring loaded hull pin is stuck against the tumbler). Once all the pins are 'set' in this way, the tumbler will turn free in the hull and the lock will open.
The same principle is used to pick wafer locks. Wafer tumbler locks differ to the pin-tumbler's outlined above as the long pins are replaced by wafers which could be described as wafers of metal that are like a thin cross-section of the tumbler. The key sets these wafers to the right height so that their shape merges with the tumbler and makes a perfect cylinder, and the different sized ridges on a key correspond to a misaligned hole in each wafer. When unset, the wafers rest inside a hollowed area of the hull, and picking these locks require the wafers to be bound against the hull in much the same way.
The complications are that the pins/wafers will not always set from the front to the back (or hardly ever will for that matter), as each lock is made differently and has its own flaws. This means going over all the pins in the lock to see which one sets next. Other complications are if you have too much tension on the tension wrench, when trying to set a hull pin, you might push the driver pin into the hull and might not know it.
Anti lock-picking measures are known to include mis-shaping driver pins into mushroom shaped pins that stick at the wrong point if tension is exherted on the tumbler.
VENDING MACHINE LOCKS
I've yet to attempt vending machine locks but I know the basic principal. These locks can be characterised by a tumbler with no keyhole and a number of pins aranged in symmetry around the edge of the tumbler that go inwards. They are supposed to be the easiest locks to pick, but the ones that require the most time to do so.
Once the tension on the tumbler has been established, all that needs to be done is to push each pin (there are typically six pins to the lock) down until it sets. The lengthy part is that the first pin you reach might not be the one that sets, so you may have to go over all six pins to get the first pin to set. 5 more times to get the lock to turn. Also, because the pins are arranged in symmetry, you will only be able to turn the tumbler a small amount before all the pins jump back into their neigbouring position. (if there are six pins, the lock will turn 60 degrees before the pins reset). Thus you have to repeat this process two more times to turn the tumbler 180 degrees (the standard to open this lock) and have to pick it three times more to close the lock again.
Simply to put this into perspective, the worst case scenario for picking this lock is as follows. You set on pin on the first go at all six, you set another after trying the other five, one after trying the four, one after three, one after two, and you set the remaining one to turn the lock 60 degrees. 21 picks to turn the lock 60 degrees. Repeating the above process twice more to open the lock requires a maximum of 63 pin-pushes, and that doubles to 126 pin-pushes if you wish to close the lock again (which you need to do if you want the key to fit back in - the key can only be inserted or removed if the mechanism is locked).
Lockpicking is fun, and very rewarding but quite frankly, those with sinister intentions for the use of this art simply dont have the mindset and the patience it takes to learn it. This knowledge is for educational purposes only and I as well as most authorities don't endorse the use of lockpicking. Play wiseley.
If anyone reading has played Splinter Cell, the cross section seen visible when you pick locks in that game are accurate, with regards to the pins, the hull and chamber and the break point, so if you see that you've got a good understanding of how locks work. The pick used to hit the pins is done correctly, but the tension wrench (the other tool) is positioned wrong, it doesnt need to be that far in the lock and its upside down.
Thanks to C-Dawg for spelling corrections. Thanks to Dannye for constructive criticism.