Contrary to what a lot of people think, cam "timing" and ignition "timing" have nothing to do with each other, anymore than a timing "belt" and a fan "belt" have anything to do with each other. They just happen to share a common word of "timing" but that word is in a completely different context from each other.
Cam timing is a relationship between where the cam is indexed at (phased) with the crank. When it is referred-to as "straight-up" or at "zero", it means it is degree for degree in line with the TDC index of the crank, where the cam manufacturer wanted the cam to be at. It isn't advanced, and it isn't retarded in relationship with the crank.
Advancing the cam opens the intake valve sooner, which brings the power curve down to a little lower RPM. In other words, advancing the cam 2, 3 or 4 degrees will make the cam's power curve come-on sooner. More sooner for each degree more you advance it (more or less anyway) This is ideal for things like trucks that need "grunt power" to get moving, or for cars with engines that don't make enough low-end torque to "get-up and go" off the line better, such as street cars, autocross cars, short track cars, etc.
It's a bad situation if you have too much low-end power and can’t control the tire traction. In cases like that, or where higher RPM power is more the goal, you can retard the cam timing by a couple of degrees and that'll bring the power-on later in the RPM range. This may be ideal for high speed cars that don’t take-off like jack rabbits, but need more top-end power, like a road race car or a car that may run at Bonneville.
Ignition timing ONLY has to do with when the spark plug lights. The distributor may be driven by the cam gear BUT, the distributor rotates freely and can be rotated in any position to set the timing wherever you want, regardless of whether the cam is advanced, retarded or straight-up. Just because they share the same word of "timing" doesn't mean they are referring to the same MEANING of what "timing" is. For some reason a lot of guys think that if their cam is advanced (or retarded) a few degrees that it affects their ignition timing. Nothing could be further from the truth. Regardless of where the cam is "phased" in relationship to the crank, you can ALWAYS rotate the distributor to achieve the ignition timing you want to have.
Ignition timing ONLY controls when the spark plug ignites. Most engines like the spark plug to ignite anywhere from 32 to 42 degrees before top dead center (BTDC), or in other words, before the piston has compressed the fuel & air all the way to the top. Usually the magic number is between 34 and 36 degrees, but every engine is different, every type and brand of fuel is different, etc, so every engine will like timing in a slightly different place than another.
Advancing the spark timing creates a better burn and more cylinder pressure. Cylinder pressure = power. When you light the cylinder as the piston is still rising to TDC, the fuel & air is expanding, yet the piston is still compressing AS those gasses are expanding. This creates a tremendous amount of pressure inside the cylinder which = power. You can only advance the timing just so far though before the fuel burn becomes uncontrolled (detonation or "pinging"), which will cause serious damage to pistons, rings, head gaskets, etc. The type of material the heads are made out of also have an effect on timing and detonation, such as cast iron vs. aluminum. It's also relevant to the static compression, the effective compression (based on the cam profile, power adders, etc.), the type of fuel being used (octane), and a few other factors.
Fuel is supposed to be a controlled burn with an even & controlled expansion. When detonation happens, it is more of an out of control explosion. If you stood behind your car and pushed on it smoothly and evenly with your hands, it'll begin to roll. It doesn’t take that much effort to get it to roll, but if you stood behind you car and smacked it with a 12 Lb sledge hammer, the force you hit the car with is MUCH greater than when you pushed on it smoothly with your hand, BUT the car didn’t move an inch. All you did was put a great big dent in the back of your car. That is what happens when detonation happens inside a cylinder... you go from a controlled burn (a push) to an uncontrolled hammer smack, which breaks pistons, hammers bearings, spits-out head gaskets, etc. So you can only go just so far on the timing before you have detonation, and when detonation happens, it's like smacking the top of the piston with a sledge hammer rather than pushing on it with a smooth & controlled burn.
Retarding the timing does the complete opposite. It lights the compressed fuel & air later (at, or after TDC) and doesn’t create enough cylinder pressure to make good power, or to create a good idle vacuum. Because the burn is lighting later and the pressure is lower, the burn happens MUCH too slow. In fact, it is still burning when the exhaust valve opens, which is why when your timing is too late, your headers will glow cherry red and your water temperature goes up. It's also why it becomes a complete turd and has no power. The engine gets lazy because it isn’t making any cylinder pressure to create any power. You need to light the cylinder BEFORE the piston reaches TDC on the compression stroke.
With too much static compression and not enough octane in the fuel, you'll end-up with pinging (detonation) problems and won’t be able to run enough timing to make any power. An engine with not enough compression and too much octane will burn too slow and too cool, and will want more timing advance to help get it out of its own way. This is why rookies that run their cars at the race track with their not so modified engines and put "race fuel" in their tanks THINKING they'll go faster, end-up going slower. They don't have enough static compression or ignition timing to get enough energy out of the fuel with too much octane. The trick is to have a matched amount of static compression, effective compression, etc. to the type of fuel being burned, and then finding that engine combo's sweet spot for where it likes the timing for where it likes the cylinder to fire at. Once that has been done, later-on you can try different cam timing settings to alter when the power comes-on at. For instance; if you have a car that makes a lot of power but doesn't have very good traction off the line, you "could" retard the cam timing a bit to bring-on the power later so you can get traction off the line and have explosive power once you're down the track a bit up in the RPMs more.