Hitting a child is something that is done in the midst of rage and fear. Often hitting the child accomplishes the goal - you will not see the activity which frightens you. The child will learn to hide it (and many other things) from you.
That will not teach him/her to not run in the street. It will teach him/her not to do it when you are around. Big difference.
Children represent a massive obligation, which is never ending. And children screw up, all the time. Hitting them will often result in BEHAVIOUR that on the surface reduces stress for the parent but does nothing to teach the child where the actual problem is.
My 2 kids 5 & 8 have not been hit to my knowledge. They are fine. They ask me all the time if it is ok to do something. I have conversations about what they think, do they think it is risky, etc. The lines are open. My mother beat me - not spanked, but beat. My father never laid a hand on me (nor did his father on him), despite a huge temper. I always went to my father to ask advice - never my mother.
Parents hit their children because of their own fear, fatigue, and desperation for a little relief from the anxiety of parenting. Life in general is a lot easier if you just get used to the fact that you are at risk of bad things happening, and your children compound that risk.