1) Carriers prevent people from changing networks by a simple method of encrypting some codes on the particular device. These code encryption won't allow a device to get accessed with any other network. The code encryption is unique for individual device. The code is based upon the IMEI number of the device.
2) Installing a new operating system won't unlock a cell phone. It can be only unlocked using its unique unlock code. Anyway there are certain unsafe unlocking methods such as flashing, Software unlocking, etc.,
3) Yes, Only unlocking code is the safest way to unlock a mobile phone. There are certain code generators. But they won't provide the accurate unlock code. Code generators provide a series of code which are generated randomly. Every mobile phone has a limited amount of tries to enter the unlock code. Exceeding the unlocking attempts my hard lock the phone resulting in making the mobile phone unusable.
If you need to unlock your HTC HD2 safer and easier you must get the unique unlock code either from the respective network provider or from any trusted vendor online. For example, You can get the accurate unlock code from www.Unlock-Zone.Com at affordable cost with free unlocking instructions.