In general, the term 'hair pin' can be used for any sort of bent or twisted piece of wire that is designed to keep your hair in place. The most common of these is the bobby pin (called a kirby grip or hair grip in the UK), but these are generally referred to, and sold as, 'bobby pins'. If someone refers to a 'hair pin', they most often mean a closely related, but very different, form of clip.
While a bobby pin is both heavily crimped and designed to pinch hair tightly, a hair pin is lightly crimped and is very loose. They are usually made of thinner wire than bobby pins, and open easily to gather up more hair. If you were to slide a hair pin into your hair, it would fall out quickly; it does not have any grip.
_______________________ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ O
\ \_/ \_/ \_/ \_/ \_/ \_/ \_/
_________________________ _______ ________ ____________o
/ \__/ \__/ \__/
| __ __ __
\_________________________/ \________/ \________/ \____________o
Other variations exist; perhaps the most popular is the Amish pin, which is a large, thick hair pin with no crimping at all.
Hair pins are primarily used to keep hair in a tight bun, where the press of the surrounding hair will keep them in place. They are much more effective at keeping stray hairs in place than a bobby pin, although absolutely useless at keeping bangs out of your face. In order to use a hair pin, first make a bun using the hair tie of your choice. Then push the hair pin straight down through the edge of the bun (perpendicular to the scalp), and scoop inwards to the bun, causing it to grab a lock of scalp hair on the way through. This locks the bun to the scalp, and prevents stray hairs from escaping. You may use anywhere from one to a million-bajillion depending on how fussy you are (most of us will top out at seven or eight).
While hair pins are much less common than bobby pins, they are still sold at most drug stores. They are a staple for dancers and fusty librarians around the world.