It's important to know that the ad-free version (as well as any other app) is associated/belongs to the account of the store you use (Play Store or App Store) and you'll be able to download it as many times as you wish without having to pay, as long as you access from said account in your device.
For this reason, if you change devices and start using one with the same operating system (Android or iOS), you'll be able to download the ad-free version again without having to pay for it, as long as you access from the same store account as the one you used in your previous device.
If a new device has a different operating system, or has the same one but you have a different store account, you'll have to pay for the ad-free version again.