People have been trying to tell the future using random patterns probably since humans have been able to think about the future. But tasseography is specifically using sediments left from drinks like tea or wine for divination; Tasse means cup in French so it is essentially cup reading. Medieval necromancers would use the random shapes formed from dropping molten wax or lead and when tea became widespread in Europe the shapes left by the leaves would be used instead. Sometimes coffee grounds or wine or beer sediments were used, depending on the culture. In the UK and Ireland, because Tea was the most popular drink, reading tea leaves predominated. As a cheap method of fortune-telling, it only required a cup of tea so became increasingly popular as both a means to tell the future and as a method of entertainment. China and pottery makers would often make specialist tea sets showing the zodiac, playing cards or symbols on them for use by Tasseographers.
The tea must be loose leaf tea, a cut open tea bag wouldn't do as the grounds are too fine, unstrained so the leaves remain in the bottom of the cup. The reader will ask the querent (the person seeking the reading) to drink the tea and they will then swirl the dregs around the cup before turning over onto the saucer to remove the remaining liquid. The Encyclopedia of Occultism & Parapsychology quotes: "The diviner now looks at the pattern of tea leaves in the cup and allows the imagination to play around [with] the shapes suggested by them. They might look like a letter, a heart shape, or a ring. These shapes are then interpreted intuitively or by means of a fairly standard system of symbolism, such as: snake (enmity or falsehood), spade (good fortune through industry), mountain (journey of hindrance), or house (change, success)."
Of course, it is just pareidolia - seeing familiar shapes in random swirls - added to an assumption that the shapes perceived somehow foretell future events. As an artform it basically died out when tea bags became popular and why today it is seen as an old woman's skill. Its surprising that reading the shapes in the foam left in a Starbucks' coffee cup hasn't superseded it!