Anyone who's ever had chickens has seen the origins of the term "pecking order" first hand. Pecking and flapping at each other is pretty normal behavior for chickens, both hens and roosters, but in its extremes it can lead to severe injury and cannibalism. So let's talk about how to avoid this and also what to do if you have a severely "hen-pecked" chicken.
At least some level of chicken aggression is tied to genetics. Breeds described as "nervous, restless and active" tend to have more aggressive tendencies, while "docile, calm, easily handled" birds are less likely to give you problems. Though some birds may be very docile with humans and still real jerks to their flock-mates. Here is a great chart with disposition information about a wide variety of chicken breeds.
My personal experience has been mostly with Golden Comets, which are a hybrid red sex link chicken that does very well in a variety of circumstances. In my system they are moved to fresh grass every two days from April/May to October and are protected from predators with mobile electric poultry netting. In the winter they are housed indoors with outdoor access (weather permitting).
Beak trimming or debeaking is a controversial practice where the tip of the hen's upper beak is removed permanently, typically done a within a few days of hatching, to prevent injury and cannibalism. If you get pullets (young hens about to start laying) from any of the larger hatcheries, there's a good chance that they will already be trimmed. When you order chicks, there is sometimes the option to check a box for beak trimming.
I raise my own pullets specifically so I can avoid beak trimmed birds as they tend to be less active foragers, also the procedure does cause a fair amount of pain (though temporary) for the chick. For homestead flocks and any size flock with access to an enriching enough environment this process is really not necessary. In flocks raised in confinement where aggression and cannibalism are issues, beak trimming prevents the painful injuries that the birds can inflict on each other. If you'd like to read in more detail, here's a welfare review of the practice by the American Veterinary Medical Association.
Introducing new birds
Birds raised together as chicks are the best option to keep aggression low. Chickens are very good at picking out any new flock members and can sometimes pick on them to the point of severe injury. However, you will probably end up adding new adult birds to your flock eventually, so here are some tips on how to do so smoothly.
If you have calm, non-aggressive birds, you can try introducing new birds by putting them in the coop after dark, when the rest of the flock is asleep. Often they will all wake up together and have now more than a few short scuffles to sort things out. Be prepared to remove the new birds if there's trouble though, so you'll need to keep a closer eye on them for a day or so after doing this.
If you'd prefer a more gradual introduction, then you will need the birds to spend some time where they can see but not touch each other. Keeping a couple new hens in a large wire crate within your existing coop is a good option, or you can separate off one area with chicken wire. Keep them like this for several days and then remove the barrier and observe the interactions. Once again, minor scuffles are perfectly normal and expected but you will probably want to separate again if blood is drawn.
Some birds are just troublemakers. So if you have a particular bully who won't leave the others alone, try treating her like a new flock member for a little while, like I've recommend above. That will give wounds a chance to heal and hopefully let the bully have a change of mindset.
Nutrition and environment
Two of the most important factors in preventing cannibalism are nutrition and environment. Nutrient deficiencies and boredom can both lead to hens attacking their flock mates and once they can see blood they will peck at it relentlessly.
As long as your feed is formulated for laying hen nutrition and is fresh, you shouldn't have any problems on that front. Rarely, a feed mill may sell a poorly mixed batch of feed that has too much or two little of important nutrients. If you have a sudden change in hen behavior or health that you can't trace to any other source, you may want to contact your feed store or feed mill to see if they have had any similar complaints or have issued a recall. This is probably one of the more unusual sources of nutrient deficiency, though it does happen.
While it is possible to feed hens solely or partially on food scraps, it is typically a pretty unbalanced diet. Other cheap feed sources like scratch grains and spent brewers mash are fine as a supplement but are still lacking enough protein and nutrition. Home mixed feeds and farmed insects can be a great option if you're willing to put the time into it, though it is still best to include a nutrient mix like Fertrell to prevent deficiencies.
High production breeds especially need a lot of calcium to produce the amount of eggs that they do. Even layer feeds often don't have enough calcium to fully meet their needs, so it best to provide a free choice source of calcium as well, such as oyster shell. This can reduce egg eating and make for thicker shelled eggs.
You can do everything else right but if you have bored hens, you will have aggression. Hens with outdoor access typically have no issues, unless the outdoor area is just a completely scratched over piece of dirt. If you don't have a way to free range your hens or regularly move them to fresh ground, then you have to provide them some entertainment. There are a lot of amusing and useful ways to keep them busy but my favorite is simply to provide a big pile of hay! Chickens love pecking and scratching through the hay as well as eating it and it really seems to keep them busy.
Some other options that I see recommended are nailing cabbages or whole root vegetables to the side of the coop or suspending them in the coop on string. That is harder to do at a large scale though, so that's why I stick to hay!
There is a lot of information out there specifically on how to handle aggressive roosters. I won't go into it here since I have personally never had an aggressive rooster but I also make sure to pick roosters from docile breeds, have lots of ladies for them to keep an eye on and usually just leave them alone.
What I will touch on briefly is the effect of roosters on aggression within the flock. While I wasn't able to find any studies, in my experience, keeping roosters can help reduce in-fighting among the hens. Whenever hens squabble in my flock, the roosters usually come running to break it up, I have even seen them break up fights between my geese! In general it seems like roosters are good at enforcing peace. However, I have also seen roosters get picked on and bullied by hens in certain situations, so they are not a cure all. Most flocks only need one rooster and they will squabble amongst themselves even in a large flock like mine. I usually keep 3-4 roosters for my 200-300 hens.
Even docile chickens that get along well can be tempted by exposed wounds. Chickens are attracted to the color of blood and since eating it is nutritionally rewarding, they will often peck an open wound and make it more and more severe. The best option it to cover wounds quickly with a colored spray or salve that's made for open wounds. I have blue antiseptic paste that works great for occasional injuries.
Chickens also do not hesitate to eat already dead flock members, so if you find your birds eating a dead chicken, it may be that it was killed by a predator or died of other causes and the rest of the flock just took advantage.