they work on a binary system. The holes in the card generally allow 2 contacts to touch, and the combination of holes generates a byte (technically, it was less than a byte, 6 bits was common). each horizontal line is a byte, and the stream of attached cards, or the deck in other systems is your serial input.
Here's the impressive bit. While we're trying to create sorting algorithms in a few lines of code, here's the punch card equivalent. It keeps filling the bays and restacking them until they are eventually fully sorted. We used the one in our store room for making the tea on. No - I'm not old enough to have used these, but we had all the kit in storage behind the computer room.
EDIT - here you go, the IBM System 3 which was punch card driven -
http://en.wikipedia.org/wiki/IBM_System/3