Name Tags are used to give names to mobs.
Once named, mobs will show a nametag above their heads, and will be prevented from despawning.
To use a name tag, first you need to use an Anvil to put the name on it. Then you can right click to apply it to a mob.
Name tags will work on any mob except for adult Villagers (because when you right click on a Villager it opens his trade screen). You can name baby villagers though.