Simply put, the crown followed male-preference cognatic primogeniture. Meaning. Female child would inherit only if she has no living brothers and no deceased brothers who left surviving legitimate descendants. This can get messy. However starting with Prince William's children it will follow absolute primogeniture, meaning his first born child regardless of gender will inherit the crown and so on.