In birds, mammals, some plants, and many other organisms, biological gender is typically determined genetically. That is, biological sex of an individual is determined at conception. But there are also many species in which gender is determined, after conception, by some aspect of the environment. In these species, gender may depend on temperature, who your neighbors are, your place in a dominance hierarchy, resource availability, or other factors. Here are some interesting examples.
All crocodilians, many turtles, some lizards and fishes have temperature-dependent sex determination. In some of these species, exposure of the eggs (or, in the case of fishes, the young larvae) to colder temperatures favors the development of males, and exposure to warmer temperatures favors the development of females. In others, an intermediate temperature favors one sex while temperatures both above and below the intermediate favor the other sex. In any case, this can mean that when a mother crocodile or turtle or lizard chooses a nest site for her eggs, she has some control over the gender of those offspring.
Gender can depend on size and place in a dominance hierarchy. Marine fishes called wrasses are typically sex-changing hermaphrodites: they can begin life as females, mating with males and producing young. But if the big male in a group of wrasses dies, the biggest female in the group transforms into a male and takes over the process of mating with the remaining females. Clownfishes do it the other way around: they begin life as males and can become females as they grow. Then, if the biggest female in a group dies, a large male turns into a female. Some parrotfishes do as the wrasses do, and others do as the clownfishes do.
Gobies are sex-changing hermaphrodites too, most of them changing from female to male. But some change from male to female. This is reported to happen when females strongly prefer to mate with large males, so small males have little chance to mate. One option, then, is to become female and then have a very good chance of mating and producing young. In one species of goby, juvenile sex is said to be determined when the juvenile meets up with an unpaired adult, whereupon the juvenile becomes female if the adult is male, or male if the adult is female, and the two make a pair.
Another example comes from the slipper snails, specifically the species known as Crepidula fornicata. These, too, are sex-changing hermaphrodites. Individuals stack up on top of each other, in piles up to twelve individuals, with big ones at the bottom and ever-smaller ones on top. The larger, older ones at the bottom of the heap are female, the small, young ones at the top are male, and the middle ones may be both.
Food availability (in addition to nest temperature) is reported to influence the sex ratio of offspring produced by alligators. Very well-fed females produce more female offspring than females that are less well nourished.
Sometimes gender can depend on timing and location. Parasitic bopyrid isopods (marine crustaceans) hatch in sexually undifferentiated form and attach themselves to crabs and shrimp. The first one to arrive on a host becomes female, and grows by feeding on the host. She attracts others of the species, and one individual attaches to the female and becomes a male. That male then fights off other arrivals, and the two form a mated pair.
My favorite local example of the effects of timing and location comes from the plant world. Deer fern (Blechnum spicant) is common in our forest understory. This fern is unusual, in that the spores are produced on a stalk separate from the leafy part, rather than on the underside of a frond. Part of the life cycle of the fern occurs underground, before the visible fern emerges. When a spore lands on the ground, it has the capacity to become either male or female. But the first one to arrive and germinate in a patch of ground becomes female. She exudes chemical signals that turn all nearby later arrivals into males. As the female of the group, she is the one that will produce the next phase of the life cycle, with its separate spore-bearing and leafy parts.
Those are just a few of the wild and woolly examples. The relative advantages of genetic versus environmental gender determination are debated, and those debates are best left to other writings. Conjectures are encouraged!