Some animals determine sex based on genes - there's multiple approaches to this, including the XY system (most common in mammals); the XO system (many invertebrates) the ZW system (most common in birds); and the XYXYXYXYXY system (pretty much just platypuses and echidnas). Under these systems, if an embryo has one type of chromosome set, it will develop as female; the other and it will develop as male (most of the time).