A padlock has three basic parts, though its design may vary from each manufacturer and model.
The shackle, which is the part of the lock that secures your goods with a hasp or chain, can be a notched piece of bent metal or wire. It may be round or square, or it can even be a piece of reinforced cable (as with bicycle and laptop locks).
The shackle is secured by the locking mechanism, which is the guts of the lock. This mechanism is what keeps the shackle from being easily removed from the chain or hasp to allow free entry to your goods.
The body is what houses the lock. The appearance of the padlock body will be just as variable as the shackle and mechanism. Each brand and model has its own appearance.
Though all locks are different, they all operate on similar principles. There are two basic types of padlocks: keyed and combination.
Combination locks come in a few different varieties. There are keypad locks, locks with a dial face and horizontal combination locks (as with many modern bicycle locks).
The horizontal combination locks are the least secure of the three. When these locks are engaged, the combination is scrambled on the face. To free the shackle from the lock, you must simply line up the correct numeric code. Each number dial has one number that will release its hold on the shackle. If you line up all of the numbers, then the shackle will come free.
The dial-face lock is more secure. To line up the cams or tumblers that are holding the shackle, you must turn the dial to the correct numbers in the correct sequence. If the numbers are not entered in the correct sequence, then the lock will not release the shackle. The lock must be "reset" after each unsuccessful attempt.
The keypad lock can be quite secure (such as with office doors), but it is easy to observe someone entering the code into a keypad and duplicate the combination. Essentially a keypad combination lock requires the user to enter a series of digits through a keypad or other button-style interface. When the proper numbers are entered in the proper order, the shackle will be released from the locking mechanism within.
Keyed locks are simpler than their combination brethren. Ancient padlocks required you use a key that was essentially a screw. The screwing action of turning the key over and over again would withdraw the powerful spring that was used to activate the locking mechanism that held the shackle in place.
If you want to open a keyed lock today, you simply insert the proper key and turn once. When you turn the proper key in the lock, you activate tumblers, disks or cams that are holding the shackle in place. The key will release the shackle every time the correct key is used to turn the lock.
If you were trying to fool a keyed lock, you would use a tool such as a bump, pick or shim to fool the mechanism by activating the tumblers in a way that mimics the key turning. If you were trying to gain entry to a combination lock, you would normally have to try a series of combinations and a sensitive listening device (to hear the tumblers line up). The combination lock is generally recognized as the more secure of the two.