Animals of the same species learn to cooperate with one another through a variety of mechanisms, including instinct, observation, trial and error, and social learning.
Instinct plays a role in some species where cooperation is hardwired into their genetic makeup. For example, in many bird species, parents work together to build a nest, incubate eggs, and feed their young. This behavior is instinctual and requires no learning.
Observation and trial and error are also important mechanisms for learning cooperation. Animals may observe the behavior of others and learn from their successes and failures. For example, chimpanzees have been observed using sticks as tools to obtain food. Young chimpanzees learn this behavior by observing older, more experienced individuals.
Social learning is perhaps the most important mechanism for learning cooperation. Animals learn from one another through imitation, communication, and collaboration. For example, meerkats live in large social groups and work together to hunt and defend their territory. Young meerkats learn how to cooperate with others by observing and interacting with older members of the group.
Ultimately, the specific mechanisms by which animals learn to cooperate with one another can vary widely depending on the species and the specific context in which cooperation is required. However, instinct, observation, trial and error, and social learning are all important factors that can contribute to the development of cooperative behavior in animals.