Because there are experts in the field of herpetology and animal behavior that have spent decades learning all the ins and outs of these animals and documenting their findings for our benefit.
Field work and first hand accounts like Justins and others that have been to West Africa, captive observations, and experimentation all play a part in how we know.
As tempting as it may be to watch a couple of internet videos and justify keeping two ball pythons in an enclosure together ... that's not science, and it's not helping your animals any.
There have been volumes written by experts about basic and advanced aspects of animal behavior ... you should check some of them out.
-adam