A Valentine from the 1860s
The fashion for people singing Valentines verses to each other may have started earlier in the Middle Ages, but the first written record we have of Valentines comes from the 1300s AD, when various medieval poets, including Chaucer, wrote poems about birds mating on Valentine's Day. Chaucer's poem may be the earliest of these. Nobody knows what gave Chaucer this idea. Chaucer probably didn't know either that February corresponded to the ancient Athenian month of Gamelion, which was a lucky month for weddings, or about the Roman holiday Lupercalia in February, because he couldn't read Greek and nobody translated the historian Plutarch into Latin until 1400 AD, the year Chaucer died.
Some sort of Valentine's tradition continued from Chaucer's time on: about 1415, a French count wrote a Valentine to his wife, and in 1477 an English woman wrote a Valentine to her fiance. Shakespeare refers to Valentine's Day too.
In North America, Valentine's Day came over with the first English settlers in the 1600s. As the sugar industry developed, people also probably began giving sugar candy for Valentine's Day. In the 1700s, when Mary Wortley Montagu wrote letters home from the Ottoman Empire, people in Britain heard about the Islamic tradition of giving bouquets where each flower had a coded meaning. Similar bouquets became popular Valentine's Day gifts.
By 1800, printers were selling paper Valentines in stores, and by the 1840s paper Valentines were being mass-produced by machines in factories. The Post Office got started about this time, and then you could send Valentines through the mail.
The invention of chocolate candy in the 1830s suggested the idea of selling Valentines chocolate as well as candy and flowers to give as gifts on Valentine's Day; by 1861, the Quaker Cadbury brothers were selling Valentines candy in heart-shaped boxes in England.
A kids' valentine from the 1970s
By this time, kids were making valentines or buying them at the store to give to each other in school, just as you do today. These cards were usually supposed to be funny, and some were very racist or sexist.
In the 1940s, with many men away at war fighting World War II, many schools had children send valentines to the soldiers. In the 1960s, with the Civil Rights Movement, Hallmark began to sell valentines meant for African-American people instead of only white people. But it was not until the 1970s that teachers decided kids should have to give valentines to everyone in the class - before that, the most popular kids got many valentines, and some kids didn't get any!