There are two types of network technology in the USA - CDMA and GSM. Basically they operate on different frequencies (like radio signals).
Sprint and Verizon run on CDMA
T-Mobile and AT&T run on GSM
The networks specifically set up the phone to run on the optimum settings for their own network and work with the manufacturers to ensure that they pass the network performance tests. Essentially a Sprint phone is set up for optimum performance on the Sprint network, this will differ ever so slightly from the set up that that Verizon do on the very same phone model.
The carriers then purchase the phone from the manufacturer, set it up for their network and then lock it to that network.
In reality it makes it slightly harder for people to switch as you need to make sure your phone is the right technology to work on your chosen network.
There are tons of carriers (they are called MVNOs) that run off each carrier network - some you will have heard of like Metro, Cricket, Boost - others are smaller. The thing they all have in common is that they run on the same networks as the big boys
If you are looking to switch and bring your own phone to a new carrier then you need to make sure that your phone runs off the right network, heres a full selection of carriers and plans that work with each carrier: