You are asking a question which one would need to write a whole book about to answer adequately. Some people seem to have this as an innate ability right from the word go, though it might be that they've had ample opportunity to observe and learn from the mistakes of others. Certainly it has a lot to do with how they themselves have been brought up.
For example, my wife was the youngest child in a family of six siblings. By the time her mother and father got around to raising her they'd probably overcome a lot of their own shortcomings. By number six they'd have been very experienced parents. Consequently, my wife seemed to know almost intuitively how much control and how much freedom to allow our three kids as they were growning up.
As it was, all three left home at seventeen. All three did well in the world and continue to do so. And all three turned out to be well-adjusted adults. But ask me how to describe how this is done in a sentence or two and I'm afraid I'll have to pass.