Science works the same way. We poke something a few different ways, observe what happens, come up with hypotheses, test them. We never get a clear "Yes, that's right!" The only answers we can hope to get are "Nope" and "Could be". A "law" is just something that we have tested many times, and gotten back "Could be" each time -- enough times that we subjectively feel satisfied.