Oh boy! That's a big question. Let me see if I can give you the basics.
Combustion is not an instantaneous process. After you ignite the air/fuel mixture, it takes a little bit of time for the combustion to happen. The goal of timing is to time the combustion so that it creates the highest pressure on the piston at the optimal time.
Envision the piston at exactly top dead center, not moving- the connecting rod is pointed directly up and down. Now, create enormous downward pressure on the piston. What will happen? Nothing- the piston won't move. You will just smash the bearing into the crankshaft (ouch!). That's kinda what happens if you fire too early.
Ideally, you'd like the highest cylinder pressure when the crankshaft is maybe 45-60 degrees from vertical. However this isn't really possible either- since the piston would be further down in the cylinder, you've lost a lot of the compression that helps improve combustion.
In the real world, generally speaking you want the spark as early as possible, without being so early that the combustion is pushing the piston down while the crankshaft is trying to push the piston up- this will cause knocking and severe damage. Rapidly worn bearings, broken pistons or rings, etc- it's just not good.
Now every car likes a slightly different timing curve- based on cam design, compression ratio, and a few more subtle things. A typical timing curve would be set up like this-
Idle timing- 15 degrees
Highway cruising (light load, a few thousand RPM) will be very high, like 40-50 degrees.
Wide-open Throttle- maybe 28-38 degrees (NA vs. boosted vs. nitrous etc. makes a big difference on this one.
If you don't have enough timing, you will lose a lot of power. If you have too much advance (i.e. start the spark too early), you will get knock and big-time engine damage.
It's a bigger topic than I've covered, but digest that and see what you think.
-Bob Cunningham