Fireworks are explosive devices used around the world in festivals, religious ceremonies, and cultural holidays. They produce different colors depending on what types of metals and chemicals are in the fireworks when it was ignited. Technological advances in fireworks led to new weapons for warfare, and have created a new art form. There are many different types ranging from ground fireworks to aerial ones.
Firework Structure and Method of Explosion:
An aerial firework is formed and sold as a shell. The shell has four components: a container, stars, a charge at the shell's center, and a fuse for explosion timing precision.  First, the shell is shot out from a mortar by exploding black powder, which shoots it out similar to how a gun shoots a bullet. The explosion of the black powder also ignites the fuse on the shell which will burn down the length of it till it reaches the charge inside the shell which makes it explode. 
Colors in fireworks are generated by "stars", which contain ingredients that when lit, produce different colored light depending on the types of chemicals contained in the stars. There are five ingredients that are most commonly in the stars.  These ingredients are: an oxidizer, a fuel to burn, a binding structure to hold everything together, and a chlorine donor ingredients to brighten the color.
Chemical Combinations for Colors:
The metals used to produce the common colors are as follows: Red-Strontium for an intense red or lithium for a medium red Orange-Calcium CaCl2 (calcium chloride) Yellow-Sodium NaNO3 (sodium nitrate) Green-Barium BaCl+ (barium chloride ions) Blue-Copper halides CuCl2 (copper chloride), at low temperature Purple-Potassium or Strontium + Copper KNO3 (Potassium Nitrate) Gold-Charcoal or iron White-Titanium, aluminium, or magnesium powders (Waterman, p639)
What produces the colors are incandescence and luminescence. Incandescence is light that is produced from heat, which makes it glow brighter colors depending on the temperature.  The temperature of a firework can be controlled to make certain colors at certain times. To increase the temperature of the firework, metals like aluminum and magnesium are used.
Luminescence is light that is produced using other energy sources than heat, which is why it is also called "cold light". It is produced by 'excited' electrons in an atom or a molecule and then returning to the lower energy level, which releases light, called a 'photon'.  Fireworks are, chemically, spontaneous reactions in which much free energy is released. A spontaneous reaction is a reaction that naturally occurs and forms products at certain conditions. (Waterman, p567) "Free energy is energy that is available to do work"(Waterman, p566)
According to legend, a Chinese cook spilled saltpeter, which is a gunpowder ingredient though was used as flavoring salt, into a cooking fire and it produced an unusual flame.  He noticed that if he tried the same with fire in a closed up bamboo tube, that it would explode. Actual exploding fireworks were produced by the Chinese monk, Li Tian, during the Song dynasty (960-1279). They commonly first used gunpowder in bamboo shoots. The Chinese then used gunpowder to propel their fireworks in the air. They used them during festivals and weddings and religious rituals because they thought that the loudness of the explosions would scare off evil spirits.  Explorers, namely the Crusaders, adopted the use of fireworks from the Chinese. European chemists experimented with gunpowder and eventually found it's maximum explosive capability in 1560 by using this ratio of ingredients: 75% Salt Peter , 15% Charcoal , and 10% Sulphur.  Then firework technology reached over into the realm of weaponry, spawning cannons and guns. Also, the Italians were creating fireworks to be used as a spectator event and an art form, as it were. 
All around the world, countries celebrate certain holidays with fireworks, be it a religious, patriotic, or a traditional holiday. Most countries do fireworks on New Years Day.  In America, fireworks are used on New Years and Independence Day. In Great Britain, fireworks are used on Guy Fawkes Night (AKA Bonfire Night) in remembrance of Fawkes trying to blow up the Parliament of England using 36 barrels of gunpowder.  Canada does fireworks on Canada Day and Victoria Day. Australia celebrates Australia Day. Thrissur Pooram in India is a festival in which fireworks are used. Diwali (AKA Festival of Lights) in India is their most popular festival which celebrates good defeating evil in their epic story of the Hindu God defeating the demon foe. 
Types of Fireworks and Effects
To name a few effects, there are the: peony, chrysanthemum, palm, dahlia, ring, salute, and roman candle. The peony is a spherical explosion of stars of multiple colors. It is the most commonly seen type of firework effect.  The chrysanthemum is like the peopny, but its stars leave a trail of sparks that can be seen.  The palm effect very much resembles a palm tree in the way that the explosion shoots out comet-like stars that resemble a palm tree's branches. When the firework shoots up, it leaves a tail of sparks that resembles the trunk of the palm tree.  The dahlia effect is like a peony with fewer stars, but they stream down a longer distance that the peony.  The ring effect does exactly what the name of it says. It releases stars in a ring pattern.  The salute effect doesn't use stars, but flash powder to give a very loud bang. They are often used the most in finales at fireworks shows because of their brightness and loudness.  A roman candle is a tube which fires stars at a set intervals.
Laws have been put in place banning fireworks in certain cities in certain states. These bans were made because of the excess injuries and accidental fires that are caused by fireworks. Also because of the noise and debris made after firing them makes people annoyed.  The U.S. Consumer Product Safety Commission (CPSC) dictates what kinds of fireworks can be sold leagally in the US.  Many black market dealers sell fireworks illegally at state borders and such. They sell them at border lines so that people from states where fireworks is usually illegal can buy them legally in that state they are selling them at. They then can sneak them back home or just shoot them off there. There are raids on people who are suspected of having illegal fireworks. 
- Chemistry of Firework Colors by Anne Marie Helmenstine, Ph.D.
- History of Fireworks by Anne Marie Helmenstine
- Fireworks Wikipedia
- How Fireworks Work by Marshall Brain
- History by Reema Gondhia
2008. Prentice Hall Chemistry, by Edward L. Waterman