How do IMEI unlocks work on iPhones?

How do IMEI unlocks work on iPhones? How are they made? I have a few iphones that i want to unlock but they are really expensive since these are carriers from canada. But, there's gotta be some way to make these codes like how are the people that do it at the stores getting all the codes? Is there a software? If so, how do i get it or make one? THNKAS

The carriers can remove the phones from the blacklist, but they won't do that for phones you've stolen.