Many different hominid and hominin groups existed throughout the evolutionary history of our species. They all differed a bit in their behavior, perception, brain, body, genetic make-up, social life. Some of them survived better and had more offspring than others. Offspring have inherited certain traits from their parents, e.g. through the inheritance of their genes or through imitation of behaviors. Their populations persisted and continued to evolve. They are among our ancestors. Others could not survive so well or have not had many offspring, and gradually became extinct.
As biotic and abiotic environmental conditions change, so do the advantages and disadvantages of having certain behavior and other characteristics for the survival of organisms. One speaks of the function or consequences of a trait: What functions or effects does a trait have under given environmental conditions for the survival and reproduction of an organism, its offspring, or its group?
For example, depending on environmental conditions, certain dietary habits or modes of locomotion are more beneficial than others. Many organisms can change their behavior quickly in response to new conditions, learn new behaviors, and can thus adapt to changing environmental conditions to a degree. However, living beings can not substantially change morphological and physiological features, or their genes during their lifetime. The change in these traits occurs only at the level of a population - those whose traits allow them to survive and reproduce better than others will have more offspring, and if they inherit these traits to their offspring, these traits will become more prevalent in the population.