Well, it depends on the bird. If I have young chicks (less than 3 days old) without a hen I just spend time with them, handle them (keep warm while handling), talk to them, touch them everywhere gently so that they bond to me. I continue working with them as they grow, handling them every day, and they learn to trust me. When they're young they follow me everywhere, fly up on my shoulders or hand, beg to be picked up and carried (that's not always a plus -- one got injured two years ago while scurrying underfoot). If you patiently teach them to trust you and work to maintain that trust, then they will be incredibly tame. They do grow up and become independent, so they don't continue begging for attention their whole life. But I can walk up to any of my free range birds and pick one up, pet it, trim and file toenails on the cocks to decrease breeding stress on the hens, and relax on a lawn chair with a towel on my lap, a few birds on the towel and my hands nuzzled under their warm wings. When those really tame and trusting hens brood their own chicks they have no concerns about me handling the eggs or the infants, and the hens teach the chicks to trust me.
All that being said, not all birds will tame down. There are some who will always be anxious, high strung, flighty, or aggressive. They hatch out of the egg that way, will never tame down 100%, and appear as if they don't have their neurotransmitters balanced properly. They still grow up and otherwise appear normal, may even meet the SOP and win shows. But their personality just isn't quite right, and their reactions to stress aren't normal. I cull those birds. I don't criticize those that don't, but for me a good bird has to have more going for it than the SOP. It needs to be a bird that I enjoy, that isn't inappropriately aggressive, that doesn't terrorize the flock, and contributes to the flock in some way.
Once the young cockerels start to feel their hormones, it is very important that the boys are never allowed to be aggressive to you. Most of them will try it at least once. Maybe not in a serious way, but they are testosterone-fueled little boys that haven't figured out how to handle the hormones, so they test their limits. If you watch how the older but sweet roosters handle the young boys, you'll see that no transgression goes unanswered, and rules are set down early. Boys with firm rules are more likely to grow up to be polite adults, regardless of the species.
The difference between the hatchery birds and the private breeder birds is a matter of stock selection. Every hatchery and breeder is different, but many of the big hatcheries do mass breedings with no stock selection. An example I read about recently was in Rhode Island Reds, where there were 600 hens and 100 cocks put in one large breeding pen, and the most aggressive cocks got to pass on their genetics. Do that for a few generations and you've got very poor quality, really mean birds. Private breeders don't always do pair-mated pedigrees, but there is usually some level of favorable selection done. When private breeders have young children that help with the hobby, good personality and tame-ability are often factors in that selection, as no breeder wants their children hurt.
Currently I have 13 cockerels and 5 pullets, all 16-19 weeks old, which are test breedings out of 5 different hens, all sired by the same cock. Of those chicks, two are high strung, anxious, more aggressive than appropriate, and will never fully trust me no matter how much I work with them. Those two chicks are from my least desirable hen, who is also a bit too anxious and was difficult to tame (but as a pullet, she was easier than her hormone-filled cockerel offspring). My best cockerels are out of my best hens, and the difference between them isn't subtle. Active selection of breeding pairs and appropriate culling by a breeder makes a huge difference in the quality of the flock.
So it's part genetics and part upbringing. It's not for everyone, but if you like bonding to your birds, the effort is worth it.