Oil lamps have been around since around 4500 BC, but in regions where olive oil wasn't abundant, people eventually had to figure out how to make candles from animal fat or wax. Like a lot of fundamental inventions like the wheel and agriculture, candlemaking was developed independently in many different countries and cultures, though the earliest known candles were from China.
In Western Europe, tallow candles were the norm for many centuries. The benefits of tallow were that it was pretty inexpensive — it's rendered sheep or cow fat, so it was a natural byproduct of meat-eating — and could be made at home. The drawbacks were that it had a pretty rank smell which grew worse as the tallow aged. It also burned very quickly, which meant that people had to be constantly trimming the wick, sometimes every few minutes.
Candle wicks at this time were simple tufts of material. The Romans, who first developed wick candles, used flax. Later, Early Modern Europeans used cotton. (It was not until the 19th century that the cotton was tightly braided so that the wick would curl down as it burned instead of allowing the flame to grow perilously higher and higher.)
Even these simple candles were too expensive for many people, who instead gathered meadow rushes, dipped them in tallow, and burned them for light. These burned incredibly fast, often lasting only 15 minutes.
Beeswax candles were available starting in the Middle Ages, and they had the major advantages of burning slower and stronger than tallow candles, AND of not smelling like rotting animal fat! But these were about 4 times more expensive to purchase than tallow candles, so their use was limited to very wealthy people and to churches.
You can see that candles were considered pretty dear resources in paintings and literature, where people often clustered around a single candle at night, even for reading or eating. In his wildly entertaining social history book, At Home, Bill Bryson cites one 18th-century letter writer who marveled at the "luminous" splendor of a grand dinner party lit by 7 candles. If you consider that one candle gives about a Watt of light, you can imagine how dark things were all the time! You can also imagine how magical a tree full of candlelight would have been in the early 1800s, showing off not only incredible brightness for the era, but also showing off how many candles the homeowner could afford to burn!
In the 18th century candlemaking technology began to change, first with the rise of the whaling industry, since it turned out sperm whale oil was a great substitute for tallow, longer-burning and better-smelling. In the mid-19th century, petroleum mining began yielding paraffin, a waxy substance which turned out to be even longer-burning and less expensive, luckily enough for both people and whales. Stearin wax was another good alternative, and these materials, combined with mechanized production after the Industrial Revolution, meant that candles could finally be easily affordable for all people.
Today, candles are still made primarily from paraffin and stearin, with beeswax a classy and pricy alternative, just as it ever was. Of course, demand for candles was totally eclipsed once the electric lightbulb came along in the late 19th century. But the candle has made a comeback in recent decades, with decorative and scented versions becoming a surprisingly large industry.