History does have a tendency to repeat itself. There are a number of ways to explain this. I am going to take a different approach and explain how history repeats itself using an example of convergence form evolutionary biology here.
Convergence or Convergent evolution is observed when similar features (similar in structure or function) evolve independently in species from different periods in time. These similar features appear in species whose common ancestor did not possess them. The most common example is that of flight. Birds and bats can fly but their common ancestor, that is, the terrestrial tetrapod could not. Thus, the flight mechanisms of birds and bats are analogous features. These two groups evolved flight independently. This has led to differences in the structure of their wings making them functionally convergent, but not anatomically. Similarly, the flight mechanisms in the extinct pterosaurs (a dinosaur), insects, flying squirrels (a mammal), and sugar gliders (a marsupial) are examples of convergent evolution. Although evolved from different body parts and have different anatomy and morphology, they perform the function of flight.
What leads to convergent evolution? - Probably the environmental constraints. When there is competition for resources on the land, organisms need to travel longer distances and flying is beneficial in this case. The flight is also a mechanism to avoid predation by terrestrial organisms or to hunt more effectively. The flight is a basic mechanism. To better survive, the species adapts to new ways. There are only a limited number of ways allowed by the environment. In this case, the ways in which an organism can transform itself is to be able to occupy space in the water, on the land, or the air. Since the number of species far exceeds the number of ways, species have no other choice but to adapt to one of these three ways to thrive better.
Therefore, to answer the bigger question “why does history repeat itself in general?” – It is probably due to a lack of choice. For each specific event to happen, there exists a limited number of options. The number of events far exceeds the number of options. Repetition is, therefore, inevitable.
Note: Along with water, land, and air, space is another, probably unexplored, area for living. Homo sapiens have made progress in that area, not biologically (not using biological evolution), but technologically (using cognition). Observing repetition here will require a larger timeline involving not only the past but also the future.