Basic phones are analog systems. Analog requires that the circuit be open the entire duration of a call. This means a call on an analog requires a constant direct connection between New York City to Los Angeles. You end up paying an extraordinary invoice because of that direct line.
VoIP is built on packet-switching. This means it is digital and not analog. Thousands of digitized voices can be compacted all at once into a single fiber optic cable. This compression reduces any latency, or lag as it is commonly referred to as.
The computers routing the calls take care of the heavy lifting. The Internet infrastructure treats the call as it would an email. They re-route continuously until the call reaches its destination.
Our friends over at HowStuffWorks.com has the full details on how this amazing service operates.