Answer: It uses natural selection to choose traits that are more favorable which is measured by if the species can make fertile offspring. For example horses can make fertile offspring like donkeys can also do this but a cross betweek male donkeys and female horses can make offspring(mule) but not fertile ones. Fertile offsprings are offsprings/ kids that can have kids.
Further Explanation:
https://www.britannica.com/science/biology/Evolution