Remembering the names of people you have been introduced to can be a haphazard business.
Some names are unusual, absurdly inappropriate, comic or pretentious, and will therefore easily stick in your mind.
Many names are instantly forgettable, and more drastic measures need to be taken. Using the name a couple of times in conversation soon after you've first heard it might fix it in your memory (but don't overdo this, or you'll sound like an importunate salesman).
Try visualisation techniques; for example as soon as you hear the name, mentally blazon it across the person's forehead. Or try a mnemonic; think of something memorable that rhymes with the name, for example. Above all, don't become so obsessed with remembering the name that you fail to participate in the conversation.
If you do forget, don't panic - you can generally negotiate your way through a conversation without naming names, and you can always find out later. If all else fails, a charming and self-deprecating "I'm so sorry, I'm terrible at remembering names, I always do this . . ." should dig you out of the hole.