Maryam Mirzakhani, an Iranian mathematician who was the only woman ever to win a Fields Medal, the most prestigious honor in mathematics, died on Friday. She was 40.