The physics
A ball hits the floor and leaves slower than it came. The coefficient of restitution e compares the two speeds. e = 1 is a perfect bounce. e = 0 means no bounce at all.
e = vafter / vbefore
A drop from h hits the floor at √(2gh). A rise needs v², so each bounce rises e² times the one before. The KE also shrinks by e² in each bounce. The rest turns into heat and sound.
h₁ = e² h KE lost = (1 − e²) m g h
The bounces go on and on, but they shrink fast. Their heights make a geometric series. Each bounce counts twice, once up and once down.
total distance = h (1 + e²) / (1 − e²)
A ball can also land moving forward. Smooth ground pushes only straight up. So only the up-down part of the velocity shrinks by e. The level part stays the same.