Mexicans are poised to elect their first female president on Sunday in a high-stakes contest for both the country and its legal system.