In major bike races such as the Tour De France, are riders permitted to use different bikes on different parts of the course? Seems to me that there would be different optimum designs and strength considerations depending on whether a leg of the course was uphill, downhill, level, or was a straightaway or required a lot of maneuverability on turns. Are there rules about that?

Also, how often does some nut spectator or even a rider in a race drop tacks or other hazards onto the race course? I can't recall that happening, but it must. Perhaps the leaders of a race are at a greater risk for a tire puncture much like the guy first in line walking through a mine field. Buy then the followers in a race have the potential hazard of having the guy in front wipe out or drop some hazard onto the road - intentionally or by accident.

Absolutely, they have Time trial bikes, bike for when climbing with very light wheels, aero wheels when they have a flat stage, etc. i am not sure that there are limits on the bikes. the only limit will be the weight of the bike which is around 14.5 lbs

The safest place on the race is about 4th or 5th line. not in the front, and not on the back