The Lupercalia was celebrated to worship the she-wolf who suckled Romulus & Remus. It started with a group of specially appointed priests gathering at the Lupercal, a cave at the bottom of the Palatine Hill. The priests would offer a sacrifice a goat, and anoint the Lupercii (young male participants) on their foreheads with the blood. The blood was wiped away with milk by other priests, and the young men laughed at them. The Lupercii then skinned the sacrificed goat and ripped the hide into strips which they tied around their naked waists. They then got drunk, and ran around Rome striking everyone they met with goatskin thongs. Young women who were touched in this manner were thought to be specially blessed, especially in regards to fertility and procreation. Lovers were chose by lottery.
As Christianity began to slowly and systematically dismantle the pagan pantheons, it frequently replaced the festivals of the pagan gods with more ecumenical celebrations. It was easier to convert the local population if they could continue to celebrate on the same days... they would just be instructed to celebrate different people and ideologies..
Lupercalia, with its lover lottery, had no place in the new Christian order. In the year 496 AD, Pope Gelasius did away with the festival of Lupercalia, citing that it was pagan and immoral. He chose Valentine as the patron saint of lovers, who would be honored at the new festival on the fourteenth of every February. The church decided to come up with its own lottery and so the feast of St. Valentine featured a lottery of Saints. One would pull the name of a saint out of a box, and for the following year, study and attempt to emulate that saint.