When you play a note and then 'hammer' your finger down on the string higher up the fretboard, WITHOUT picking it again, you're executing a 'hammer-on'. They are mostly used when playing melodically and you want to go up in pitch from one note to another without picking both notes. You pluck the first, then hammer your fingertip onto the new fret position. The vibration from the initial pluck continues on and the new note rings out. You need to be very positive about bringing your fingertip down, however. That string has to be shorter before it knows what hit it. Only then will the ring carry through both notes.
If you're slow and meek about it, the note will die. You'll find that when you get good at it, you can make any note ring out without any picking at all, that the firm hammering action is enough in itself to get the string a'ringin'. Hammer-ons only ever let you go up in pitch, since, by their very nature, you are always going to be shortening the string. Shorter string = higher pitch. Hammer-ons are the opposite of pull-offs, and you'll find that they usually go together in a line or phrase; that you hammer-on going up, pull-off coming back down. The video above goes into it all in detail.