Many locks are made of the same basic parts: pins (usually 12) and springs. The upper six pins are the same size, and the bottom six pins come in varying sizes to match up with the grooves on your particular key. The little springs serve to hold the pins in place. When the correct key is inserted into the lock, the grooves in the key push the pins up until the upper pins are all above the shear line and the key is then able to turn in the shaft.
Some locks, such as those in an apartment building, are made to work with two types of keys: the key that is specific for that lock (known as a change key) and a master key, which can open that lock and the others in the building. A building manager or super might have a master key in order to be able to help tenants get into their apartment or to make repairs, while each tenant's key only works for his or her own lock.
The difference between a regular lock and a master lock is that the master lock has got an extra pin in some of the pin pairs, called a master wafer or spacer. When the change key fits into the lock, the tops of the master wafers are raised to the level of the shear line, but when the master key is put into the lock, the tops of the bottom pins are also raised to the level of the shear line. To pick a master lock, you'd have to raise the pins up with a pick until you hear a click signifying that the pin reached the shear line; then rotate a screwdriver in the keyhole as if you were turning a key.