You can’t always tell what sex a bird is by looking at it. Pigeons or starlings, for example, look almost exactly the same. In general, males are more colorful. For some birds females may be duller and more brownish. Sometimes females are smaller (but this isn’t always the case—especially for hawks where the opposite is true).
One of the main causes of death in birds is predation (birds get killed by predators like cats, owls, and hawks). Different bird species have developed different ways to help minimize predation. In the case of the Northern Cardinal, these birds develop what is called “cryptic coloration.” The female is not as showy as the male and blends in really well with her environment, especially when she is sitting still on the nest. Her brown color helps protect her and the eggs or young in the nest. The male, on the other hand, has the job of first attracting a female and then protecting her. For the male, it is important to stand out, so males are bright red in color.