@xzy45 @Ziltoidia @Mynona @PohlMe They don’t “choose” to do it. Hens only have one developed ovary, the other just sits there as a generic gonad. If the developed one is knocked out of action in some way, the other one develops. Usually, it turns into an ovary but occasionally it becomes a testis, which gives the hen male secondary sex characteristics. They aren’t fertile, even if they produce sperm, because they don’t have the right plumbing.
You can also do cool stuff with incubation temperatures that mean you can hatch roosters that only produce female offspring.