Hammer on basically is any time you pluck the string, or actually produce a note I should say, with your left hand or your fretting hand.
What you do is you actually, as the name implies, hammering your finger down to produce the note. It's to get a note that's higher than a note that you're already fretting.
Let's say that I'm playing this G on my sixth string, and I want to get to this A. Instead of actually putting my finger down and plucking another note, I'm going to hammer my finger down. It's a great technique.
Try doing hammer-ons with different fingers.
That's with your second finger.
That's with your fourth finger.
Notice that I'm only picking once. I'm picking the first note, and then my finger comes down and hammers the string to produce the second note. That in a nutshell is hammer-ons.