Go to a vampire cave, wait until they attack you with a red spell (sanguinare vampiris) and don't do anything. It'll hurt you, but wait till a message comes up saying 'You have contracted Sanguinare Vampiris' and then either kill 'em or flee.
To get rid of it just go to a shrine of the divines (anyone) within 3 game days and you'll be cured.
Here is a link to the UESP wiki detailing much about what you need to know about vampirism in Skyrim, including how to become infected: Skyrim: Vampirisim.