That exhaust leak is most likely causing your *pop*. Get it fixed (with a brand new gasket!) It probably won't really hurt anything right away, but you are definitely losing power.
The easiest way to avoid detonation is to use quality gasoline in the recommended octane grade for your car. It should be written on the speedo, the gas lid, and your owner's manual. Unless you've modified the internals of your engine or your ECU, this will be just fine.
The classic way to inspect for detonation is to inspect the tips of your spark plugs (because, of course, they are right there in the middle of it all!)
Here's a primer:
http://www.centuryperformance.com/spark2.htm