I've also heard that people in the past knew about orbits even when they thought that Earth was at the center of the solar system. How did they figure this out in their times with their technology?
The same celestial objects (stars, planets, the Moon) could be seen every year. So, people figured out there was a pattern to it.
At first, geocentrism was prevalent due to prejudice and the stars "orbiting" the Earth in a clean manner (no strange effects). If you stare up at night, stars move in a circle with the center approximately at the Pole Star. This can be mistaken for the Star moving around the Earth.
Objects like visible planets (with retrograde motions) were relatively small in number — we have the inner solar system plus Jupiter and Saturn, so people gave plausible explanations for these. Ptolemy theorized that the planet orbits around a "ghost point", for example:
(This is called the epicycle theory)
how we know for certain today that planets really move in orbits around the Sun (i.e., rather than moving but not around the Sun or moving around the Sun in a shape that is not a regular path).
The heliocentric model came up because of various smaller discoveries:
- Jupiter has moons, so not all celestial bodies orbit the Earth
- Venus has full phases, but in the geocentric model only a small subset of the phases should be visible
- Theories like epicycles were not as accurate as they were expected to be, and people started realizing this over time.
With all this in mind, the simple solution of heliocentrism explains everything in a much cleaner fashion, without leaving much doubt in mind. Kepler's laws make much cleaner predictions.
Remember that people had catalogs of astronomical data to verify things with.
Later on, once Newton came up with his theory of gravitation, Kepler's laws made even more sense (though I believe that Newton formulated his theory with some inspiration from Kepler's laws). I'm pretty sure that there were on-Earth experiments to verify the inverse-square as well.
Nowadays, sending probes to space and getting a different perspective has confirmed this with 100% certainity for us. More or less.