Detonation is when your flame front, caused by your spark plug igniting, does not impact your piston uniformly. Detonation can also be caused by a lean air/fuel mixture. Pre-ignition is not the same as detonation. Pre-ignition is caused by a hot spot inside your cylinder which prematurely ignites the air/fuel mixture well before the spark plug was intended to fire. Both will cause what people defer to as "ping" and "knock". If your car is equipped with a knock sensor, it is constantly "listening" for knock/ping. When it finds it, it will gradually retard your timing to try and get rid of it. This will eventually lead to your CEL coming on to alert you to the problem.
As far as your fuel mixture and octane ratings...
A lean (more air, less fuel) mixture is likely to cause detonation. A rich (more fuel, less air) is likey to bog down your engine and decrease your gas milage. What stuntstere said about higher octane fuels buring better is semi true. A more correct statement would be to say that higher octane fuels are more resistent to knock than lower octane fuels. Most nitrous and turbo kits will tell you to run 93 octane. If you ran regular 87 octane, you would be more likely to detonate. There was a wonderful FAQ I read about the differences in octane ratings, how they get them, and what's best for your setup. Older cars that have higher amounts of carbon deposits in their engines will also benefit from using 93 octane to help deduce the risk of detonation and pre-ignition, but these are generally cars that are 10 years old or more. If I can find the link to the site I found about the octane ratings, I will go ahead and post it up. You might wanna run a search and see if somebody has already posted it in the past.
Hope this helped out a little.