So on the basic level we have XX and XY being female and male.
On a slightly deeper level there is the SRY gene, the testis-determining factor, which is found in on the Y chromosome in normal human development, and can be translocated to the paternal X chromosome resulting in a person with XX chromomsomes having male sexual characteristics, while being infertile and having typically female stature, or in the case of an SRY- XY individual, female sexual characteristics but a more male stature.
On the XY side there are conditions such as 5α-Reductase deficiency, which is a genetic disorder resulting in individuals having testicles inside their body but having in many cases female external genitalia, resulting in the individuals being assigned female at birth. As this is a recessive, inherited condition, it is locally more common in certain regions, though globally rare. People with 5ARD are SRY+. Those with 5ARD may be assigned female at birth without much thought, and raised at such. Given the presence of testes producing testosterone, at puberty 5ARD individuals are virilised to some degree, and it some may change gender identity to male, though this is not at all universal. www.bbc.co.uk/news/magazine-34290981
Separately to the issue of 5ARD, there is the issue of androgen insensitivity. Androgen sensitivity is linked to the AR gene on the X chromosome. A recessive mutation can cause an XX or XY individual to not respond to be either partially or totally immune to the affects of testosterone. Hence, since the formation of male genitalia occurs in utero in response to testosterone, an XY individual who is totally androgen insensitve, will be born with female genitalia, despite being SRY+. There is also partial androgen insensitivity, which results in undervirilised males.
Between 1972 and 1996, genetic testing was conducted at the Olympics, not for XY chromosomes, but rather for the SRY gene.
The rate of SRY+ female athletes was 0.25%, and those affected appear to have been XY, with either AIS (complete or partial) or 5ARD.
Since 1996 the policy of genetic testing was abandoned, on the basis that testing was intrusive and there was no specific evidence of unfairness in terms of results.
In addition, intersex rights have become more generally recognised in terms of surgery performed on minors, and a recognition that individuals with disorders of sexual development have a right to make decisions for themselves.
So the position as of the last few years is that in general there is no right of sporting bodies to pronounce that an individual is ineligible on the basis of having an SRY gene, for example. This right of self-determination is being embraced by transgender women, who assert that their identity may be the result of 'hormone flushes in the womb' and similar things.
There are elite female athletes with XY chromosomes, SRY genes, internal testicles, and male skeletons, who appear to be androgen-sensitive, as a result of 5ARD and possibly other conditions, though I am not sure if any other specific conditions have been identified in elite female athletes besides 5ARD and AIS.
The case of complete androgen insensitivity is apparently uncontroversial, in that those affected have XY chromosomes and may tend towards larger stature due to genes found on the Y chromosomes, but they do not get respond to testosterone in the way that women or men do (women subject to testosterone doping over the long-term have been known to develop male gender identity).
However this leaves in general those who have been assigned female at birth but are partially sensitive to androgens, or completely sensitive, but have atypical genitals.
The right of intersex people with a genetic DSD to express their gender identity has resulted in a position that 'female' is those recognised by law as female, which in Western countries may include those who have gone through male puberty and have male skeletons, but that such people should undergo hormonal testosterone suppression to compete, unless completely androgen insensitive. Under normal circumstances women produce up to around 1.5 nmol/l of testosterone, and with polycystitic ovaries this may go up to around 3 nmol/l. Limits for testosterone have been set, respectively at 10 nmol/l, and 5 nmol/l, for the duration of the entire period an individual wishes to compete. The limit appears to be based on the testosterone level of women with ovaries that are producing excessive amounts of androgens (PCOS), who are XX females, even if subject to the virilising affects of testosterone.
Alternatively the limit could be seen as based on a statistical distribution of testosterone production in women, with limits being based on a certain number of standard deviations. However it is not necessarily the case that XY individuals with atypical (i.e. female) genital development will have testosterone production that fits into a normal distribution, as whereas female testosterone is around 0.5-1.5 nmol/l, male testosterone is 10-40nmol/l, so an individual who is producing male levels of testosterone due to the presence of (internal?) testicles is not necessarily pertinent to the statistical distribution of female testosterone levels.
The testosterone range of athletes competing in recent games has been published, and in the female 800m, there are one or more athletes with testosterone levels over 30 nmol/l.
It has been suggested that leading female 800m athletes are virilised, based on their appearance, stature (one athlete is 1.85m tall), and SRY+.
This has resulted in considerable time & effort being expended to attempt to prove specifically that these athletes have an unfair advantage, most recently with the IAAF introducing rules limiting testosterone levels for individuals with certain DSDs to 5 nmol/l (currently suspended pending review by the Court of Arbitration for Sport), but only in certain events.
The rules stating that testosterone levels are being restricted for individuals with DSDs, but only for specific events, runs contrary to intuition in that we know that in general, androgen-producing androgen-sensitive individuals (i.e. men) are very much stronger & faster than those producing limited androgens (women).
The problem, however is that there is a human rights implication in us simply declaring that 'a person who is SRY+ and who is androgen-sensitive is not female', in that these individuals may not be aware of their condition, despite amenorrhea, being from developing countries, and it is clearly humiliating to disqualify athletes as being 'not female', when they were not aware of their condition previously.
How do we prove, in general, that a certain condition, which is very rare, gives an unfair advantage? A certain genetic mutation may result in female genitals, for example, but it's hard to prove what other effect it has.
And how do we then handle the transgender people who will loudly insist that they also have a disorder of sexual development, and will happily cite papers to support their case?