Why does an aircraft leave a white smoke trail?
Actually, there are three types of trails an aircraft can leave in the sky:
1. Condensation of water vapor in the exhaust gas and/or the wake
This needs the very cold, very dry air at higher altitudes between 6000m and 12000m. Water vapor in the exhaust stream condenses and, pushing the local air above its saturation water content, forms a white, frozen mist. Also, particles from partially burnt fuel form condensation cores wich stabilise the contrail and let it grow over time from humidity already present in the air. Depending on the atmospheric humidity, these contrails disappear rather quickly by sublimation or can stay in place for hours and even grow into cirrus clouds. They are called condensation trails or short "contrails".
Cirrus clouds triggered by aircraft contrails (picture source)
While the added water vapor in the exhaust gas helps in contrail production, the condensation happening in the pressure field around an aircraft can already produce a contrail all by itself. If the relative humidity is close to saturation and the condensed droplets freeze quickly, the aerodynamic contrail will disappear rather slowly. The same condensation happens also at lower altitude but will not leave a contrail in temperatures above 0°C. Fog (liquid droplets) will vaporize quickly, but when frozen the condensation will last longer, until the water is re-absorbed by the air by sublimation, a much slower process than evaporation.
Engine and aerodynamic contrail forming behind an A340 (picture source)
2. Smoke from unburnt or partially burnt fuel
This was prevalent in early jets and allowed to spot them from a distance - just follow the black line, at its tip is an aircraft. Smokeless combustor cans which allow more fuel-air mixing put an end to this. For more information I recommend the excellent web page contrailscience
This B-47 uses rockets to accelerate quickly which leave the biggest smoke trail, but also the old J-47 left a lot of smoke behind (picture source).
3. Oil mist or smoke flares
The third source is shown in your picture: Oil is injected into the hot exhaust stream which forms a dense mist. This can be done with jets and piston engines, and gliders or parachutists use smoke flares. Once they are ignited (in most cases electrically) they burn down and cannot be switched off.
Smoke flares on the wingtips and fuselage of a glider (picture source)
There are many more things that can be sprayed from an aircraft (fuel, obviously, when it has to be dumped in an emergency, fertilizer or insecticides, silver iodide to seed clouds), but these are special cases. I encourage you to visit contrailscience.com for an exhaustive list of those other cases.
LS-10 glider dumping ballast water (picture source)
Most aircraft that leave trails aren't leaving smoke. It's condensed water vapour; essentially, clouds. These are called contrails. This can be caused by the water in the engine exhaust condensing, or by the disruption of the air by the passage of the aircraft triggering the condensation of water that was already present.
Some aerobatic aircraft have smoke generators which leave much thicker and more visible trails which can be turned on and off and don't depend on particular atmospheric conditions. White is most common but other colours are possible.
The Blue Angels in your photo are an example of aerobatic aircraft with smoke generators.
The Blue Angels and other display teams have smoke generators in their jets, which have the specific purpose of generating a smoke trail because it looks cool. Smoke trails at airshows are generally for that purpose. The generators inject a small amount of diesel into the jet exhaust to generate white smoke, and dyed diesel to make coloured smoke.