Well, we experiment. Sometimes by trial and error. So we continue to do something with minute changes until you get what you’re looking for. We also use complex modeling to give us the right answer which we can try out in the lab. Newton was a very special case because he viewed everything with a highly scientific and analytical mind so when the vast majority of us would have said
‘Ouch! Blummin’ apple! I’m going to have a massive lump on my head for weeks now :-(‘
He probably thought the same and then questioned why it fell to the ground.
I don’ think there is really any magic involved. Luck? Yes. Hard work? Yes. Magic? No!
When people think about things in a new way, that often leads to discoveries, or when people do experiments that have not been done before, they can discover new things about the universe, and life.
It was actually Isaac Newton that explained gravity. He was doing lots of experiments observing the planets and their orbits, and discovered that it was the same force that keeps the planets in their orbits, as makes apples fall to the ground. This totally changed the way people looked at the universe. But it was all done through careful, systematic observation and then trying to understand what theory coudl explain those observations.