Because according to the WOIAF, “in the eyes of many, the Great Council of 101 thereby established an iron precedent on matters of succession: regardless of seniority, the Iron Throne of Westeros could not pass to a woman.” (p. 65)
Prince Maegor was likely overlooked b/c he was an infant, there was suspected insanity, and apparently the Lannisters bribed everyone.