Targaryen Succession
An uncle before a daughter.
This is a form of
agnatic primogeniture, which greatly favors males over females inheriting. Female lines are disinherited, so males typically always inherit before females, even collaterally related males (i.e. uncles/brothers over daughters). It's not entirely clear how male-driven the Targaryen succession was, since they never had to look very far for a suitable male heir. It's likely a female could inherit if they were the last descendant of the patrilineal lines (male derived lines). For example, a more distant male relation from a female line (e.g. king's sister's son) wouldn't inherit over a daughter of a king, but a male relation from a male line (e.g. king's brother's son) would. (credit to
/u/feldman10) The Targaryens at first followed Andal succession, but started following this form of succession following the
"Dance of the Dragons" when Rhaenyra and Aegon II (half-siblings) fought over their father's crown.
...
Bastards
In any of the above laws of succession, bastards do not inherit at all. However, if a ******* is legitimized they stand to inherit
after all trueborn children, including daughters and younger siblings (credit to
/u/Axetronaut). Although this is not always the case and can be a point of contention and dispute. This is why Roose is convinced that Ramsay will kill any children Fat Walda has, because those children would be trueborn to Roose and thus come in line before Ramsay (ADWD 32: Reek III).
Typically only acknowledged bastards (i.e. ones welcomed into the father's house) are legitimized. Ramsay Snow, Jon Snow, Aurane Waters, Edric Storm, Joy Hill, and the Sand Snakes are all examples of acknowledged bastards. People like Gendry and Mya Stone are unacknowledged bastards, so it is exceedingly unlikely they would be legitimized, as they would need proof of their lineage and they have none. Also, only a King can legitimize a *******, not a Lord or even Lord Paramount.