Contrails, short for "condensation trails," are created by the warm, moist exhaust from an airplane's engines condensing when it interacts with the cold air in the upper levels of the atmosphere.
Contrails forming behind a Boeing 747, taken by Joe Thomissen. Source.
The easiest (and probably oversimplified) way to put it is to think about a really cold morning. You walk outside, take a deep breath, exhale, and see a huge cloud form in front of your face. It's pretty much the same thing. Your warm, moist breath is interacting with the cold morning air and condensing the water vapor, creating that cloud. When a jet aircraft is at its cruising altitude (for large aircraft going a relatively long distance, it's over 30,000 feet), the air temperature outside the aircraft can be as low as -60Â°F.
Depending on humidity levels, this contrail can last a few seconds, a few minutes, or even many hours at a time (with higher humidity extending the life of the contrail).
Numerous long-lasting contrails over the southeastern United States. Source.
The numerous and persistent nature of contrails on days with high upper-level humidity has led some to believe in a conspiracy theory called "chemtrails," stating that the contrails are really chemicals being sprayed from airplanes to affect or experiment on humans. These theories have little basis in fact. Most "evidence" for chemtrails (or any CT, really) comes in the form of roundabout/self-replicating citation -- Person A writes a story about chemtrails. Person B cites Person A's story about chemtrails as proof they exist. Person A cites Person B as proof they exist, so on and so forth.
The Air Force's website has a good writeup on contrails, and a page or two dispelling the "chemtrail" hoax towards the bottom of the document. (CAUTION: PDF File)
Sometimes a contrail can have a different color to it, or appear to have a rainbow in it. The cause for mutli-colored contrails is usually an effect caused by the sunset. The rainbow effect in some contrails is called cloud iridescence. If the contrail is thin enough, it allows the sunlight to diffract through it, causing a rainbow effect in the cloud.
Cloud iridescence in a contrail. Photo by Mila Zinkova. Source.
The opposite of a contrail is a distrail, short for "dissipation trail." A distrail occurs when an airplane flies through an existing cloud deck and the exhaust from the plane's engines dissipates the clouds in its path. They're pretty rare, but cool to see.
Distrail through a deck of clouds. Photo by Mila Zinkova. Source.
Q: Why do they appear wavy, zig-zagged, or have holes in them at times?
A: The shape of the contrail has to do with a few factors. Upper-level winds are usually the biggest factor. If winds are strong, the contrail will quickly flatten out and become distorted. Other aircraft or other clouds might also fly through/enter a contrail and help to distort its appearance as well.
Q: Why do contrails frequently appear in a grid pattern?
Flight approaching Atlanta Hartsfield Jackson Int'l (in blue). Flights in green are going to other major airports. Source: Flightaware.com.
A: They appear in a grid pattern because of the way air traffic control directs planes to their destination. Instead of having planes fly directly from point A to point B, they direct them along pre-determined airways (routes) to keep them from colliding with other aircraft. There are tens of thousands of commercial and private flights every day in the United States, and it takes a good amount of effort, coordination, and gridding to keep the planes safely spaced apart.
Q: During takeoff or landing, sometimes I see little white streamers appear on the edge of the wing or on the flaps beneath the wing. What are those?
A: Those are called wingtip vorticies. They form differently from how contrails form. As the wing flies through the air, they create little vorticies at their edges. The high speed rotation and low pressure inside these vorticies can condense the air on high humidity days, and create that streamer from behind the aircraft. It's the same reason you can see tornadoes -- the visible tornado is due to the pressure and speed of the rotating winds condensing the air.
Condensation inside the wingtip vorticies of a landing Boeing 757.