|MadSci Network: Chemistry|
This is a very good question. It is not quite as easy to answer as you might think.
First, gasoline is not a simple chemical compound like water or ethanol. It is a mixture of hundreds of different compounds. The reason for this is that gasoline is made from crude oil. Crude oil, or petroleum, is made up of thousands of different compounds, and the exact compounds present and their relative amounts differ depending on where the petroleum is produced. (For example, oil produced in West Texas differs remarkably from oil produced in the Middle East.) After the oil is produced (or taken out of the ground via oil wells), it is shipped to an oil refinery, where it is separated into different products, including gasoline, jet fuel, and diesel fuel, among others.
The separation of the oil takes place in a process called distillation. (Note that there are other processes which occur in a refinery as well, but the simplification to consider just distillation is not too far off.) In distillation, the oil is heated until it starts to boil. Some of the thousands of chemical compounds that make up the oil start to boil at low temperatures, and some do not boil until the petroleum has been heated up to higher temperatures. The different products (such as gasoline) that come out of a refinery are defined by their boiling temperatures during distillation. The lightest compounds (those that boil at the lowest temperature) become aviation gasoline, the next lightest become automotive gasoline, the next lightest become lightweight solvents and so on. In order of increasing boiling point, some other categories of refinery products are jet fuel, kerosene, diesel fuel, lubricants, greases, and asphalt. Gasoline is typically made from the fraction of the crude oil that boils at temperatures between about 50 degrees Celsius and 200 degrees Celsius.
So, we can't say for sure exactly what compounds are present in gasoline, but we can define gasoline to some extent. First, it is made up almost entirely of hydrocarbons, which are molecules made up of carbon and hydrogen. (Some of the compounds present in gasoline also contain small amounts of other elements, including sulfur, nitrogen, oxygen, and some trace metals.) Next, those hydrocarbons which make up most of gasoline boil at temperatures between about 50 and 200 degrees Celsius (120 to 400 degrees Fahrenheit). This means that these compounds are mostly those hydrocarbons that have between 6 and 12 carbon atoms in each molecule. A good average is probably octane, which has eight carbon atoms and 18 hydrogen atoms and is written C8H18.
The second part of your question is a bit easier. Although gasoline contains many different chemical compounds, it is made up mostly of hydrocarbons, and all hydrocarbons form the same products when they are burned (just in different amounts). When a hydrocarbon is burned (that is, reacted with oxygen), it forms carbon dioxide (CO2) and water (H2O). For our "average" gasoline of C8H18, the reaction is 2 molecules of octane reacting with 25 molecules of oxygen (O2) to form 18 molecules of water and 16 molecules of carbon dioxide. Of course, this reaction only occurs completely in an ideal world. In the real world, there is usually not quite enough oxygen available fast enough inside your car's engine to allow the reaction to occur completely, so there is also some carbon monoxide (CO) formed as well. In addition, since the oxygen is provided by bringing air into the engine, and since air consists mostly of nitrogen, some oxides of nitrogen (NOX) are formed as well. Finally, some of the trace elements in the gasoline (such as sulfur) can react to form small amounts of other pollutants, such as SO2.
So, to sum up, gasoline is a complicated mixture of hydrocarbons boiling between 120 and 400 degrees F, with chemical formulas between C6H14 and C12H26, but a good "average" compound is C8H18. These react in an ideal situation to produce carbon dioxide and water, but in an actual automobile engine they also produce some amount of undesirable compounds including carbon monoxide, oxides of nitrogen, and sulfur-containing compounds. I hope this helps to answer your question.
Some links you might find interesting:
The How Stuff Works Oil Refining Page has a pretty good basic-level introduction to the processes involved in refining crude oil, including distillation.
How Stuff Works page on petroleum fuels
The Chemical Engineer's Resource Page Student's Guide to Refining has an admittedly more advanced overview of refining processes, but may be of some help if you would like more information on this topic.
Try the links in the MadSci Library for more information on Chemistry.