To ensure that you do not lose access to your city when you purchase a new device please make sure you have secured your account using Game Center (iOS) or Google+ (Android) as well as connect your city to your Facebook account.
Android: Your city will also be connected to your primary email account that is associated with your device. To be able to recover your account on a new device, please setup the same email account on your new device as either the primary or secondary email account.
If you know that you have properly secured your account then head over your our account recovery page! The process to transfer to a new device is the same as recovering your account.