Charles Darwin's The Origin of Species (sixth edition) does not
explain how systems in organisms (such as for reproduction) could have come
about through evolution. However, an excellent model for exploring this
matter is the genus coryanthes (bucket orchid), which Darwin characterizes
as an "extraordinary adaptation."

I will denote as "pre-cory," coryanthes' most recent ancestor genus that
had not yet begun forming the reproductive structures that would ultimately
become those of coryanthes. For pre-cory to have evolved to coryanthes
means that the former gave rise to a series of descendent varieties,
each possibly many generations removed from its nearest ancestor
variety, whose structures reflected gradual change until they became
those of coryanthes. Because these structures would be unable to carry
out reproduction until they had fully formed, the descendent varieties in
this series would need to have retained the pre-cory reproductive system.

Darwin states that a given generation of a particular variety is highly
unlikely to yield a new variety, which implies a negligible probability
that a new variety would differ in more than one respect from its nearest
ancestor variety. This and the previous discussion imply that in the first
descendent variety of pre-cory that would have a fully formed and
functioning coryanthes-type reproductive system, which variety I will call
mezzo-cory, the pre-cory reproductive system would have remained intact.
For mezzo-cory to evolve to coryanthes would entail the gradual receding
of the pre-cory reproductive system, thereby leaving only the
coryanthes-type reproductive system.

Let's assume that the evolutionary chain from pre-cory to mezzo-cory
comprised 100 distinct varieties, which doesn't seem unreasonably high,
given the elaborate structure of coryanthes.
The first of these 100 varieties will be denoted here as pre-cory-1.
During the second step in this evolutionary path, pre-cory would give
rise to a new variety I'll denote as pre-cory-2 (to distinguish it from
pre-cory-1: the first "child" variety of pre-cory), and pre-cory-1
would give rise to a new variety I'll denote as pre-cory-1a.
In the third step, pre-cory-1a would give rise to pre-cory-1aa,
pre-cory-2 to pre-cory-2a, pre-cory-1 to pre-cory-1b (being that
pre-cory-1a was used to denote the first "child" variety of pre-cory-1),
and pre-cory to pre-cory-3. These steps are depicted in the diagram below.

Darwin notes that a variety that has a partially formed adaptive structure
that does not benefit the plant, will be at a competitive disadvantage
because the structure will nonetheless require resources to form.
This implies that of the varieties in the above chart, pre-cory would
be the fittest to survive; pre-cory-1, pre-cory-2, and pre-cory-3 would
be the next-fittest; pre-cory-1a, pre-cory-1b, and pre-cory-2a would be
still less fit; and pre-cory-1aa would be the least fit. A generalization
of this is that at any given step, the most recently formed variety in
the chain from pre-cory to mezzo-cory would be the least fit variety
that descended from pre-cory.

However, in order for mezzo-cory to have eventually formed, we have
to assume that each of its predecessor varieties, despite their
progressive lessening of fitness as they approached mezzo-cory, would
have survived for enough generations to have brought about the next
variety in the evolutionary chain to mezzo-cory. This resilience would
apply also to the varieties descending from pre-cory that are not part
of the chain that culminates in mezzo-cory, because each of those "spur"
varieties would have more modestly developed (and consequently less
resource-intensive) adaptive structures than would the variety in the
chain from pre-cory to mezzo-cory that had formed during the same step.

Implicit in the above diagram is that with each step in the evolutionary
chain from pre-cory to mezzo-cory, there is a doubling of the number
of descendent varieties of pre-cory, including pre-cory itself.
The number of existing pre-cory descendent varieties at the 100th step
would thus be

2100 = (210)10 = 102410,

which exceeds

100010 = (103)10 = 1030 =
one nonillion.

Being that this number of varieties would far exceed the planet's capacity,
the vast majority of these hypothetical varieties would never come about,
and the descendent varieties of pre-cory that are closest to mezzo-cory would
seem the least likely to reproduce (because of the high resources required by
their mostly formed but nonfunctional coryanthes-type reproductive system).

If despite the fierce competition faced by its near-ancestors, mezzo-cory
were to come into existence, the competition faced by its near-descendent
varieties, each of which would have a nearly fully formed but
nonfunctional reproductive system in addition to its functional
coryanthes-type reproductive system, would be even more intense.
This would be partly due to the procreative
advantage held by mezzo-cory, owing to its two working reproductive systems.
But if despite the enormous odds against it, coryanthes came about in
this way, one might well have expected to also find surviving instances of
mezzo-cory, which would seem poised to compete at least equally
against coryanthes.