If you saved contacts as Google (aka Gmail) contacts to your Google account they will be restored when you add your Google account to the new device.
If you did not save them to your Google account, on the old device export the contacts as a .vcf file. Import the .vcf file into your Google contacts online. Sync your Google contacts on the new device and you're good.
Contacts really should be saved to your Google account for automatic backup and easy restoration or transfer to a new device. Foolproof and super simple.
Android since v1.0. Linux since 2001.