Zip codes were created by and for the United States Post Office (USPS).
Zip stands for Zone Improvement Plan and believe it or not, they were not created that long ago - the original 5 digit codes created in 1963 and the additional 4 digit codes that are often found after the first 5 came about 20 year later in 1983.
To help people understand the new system, the Government, of course made a music video. It is about as good as you'd imagine and can still be viewed:
USPS Zip Code Video
But what about those who cared not for the talkies and that hippie music? Fear not, for they also made a stamp.
as well as a neat mascot named Mr. Zip - no idea how they came up with that one.
A precursor to the Zip code was created in 1943, due to more experienced postal worked being sent to war - the USPS came up with codes for districts in 178 'large' cities had postal zones to help with deliveries by the less experienced
Now zip codes are often translated into bar codes, making it easier for our one day robot overlords to sort the mail - just the mail. However, in all seriousness they are currently used by sorting machines to, well, sort. This barcode can be printed by bulk mailers, you, or me if we ship from home.
So, as interesting as that is, you may actually want to know
how they work well, I have no idea. Just kidding. It is actually relatively simple. They work as follows:
The first digit represents a group of states, the second and third represent regions within that cluster of states, the fourth and fifth digits are for delivery addresses and groups within what the first 3 digits represent.
The following picture breaks down regions: