What you do depends on how you want to setup your Mac. More specifically, do you want to just do a totally clean installation of macOS, or do you want to migrate your existing setup (including users/data) across to the SSD?
Regardless, you will need to format the SSD first. Probably the easiest way to proceed is to connect it to your Mac via an external enclosure and then use Disk Utility to format it.
If you haven't got an external enclosure (or another way to connect the SSD), then you could insert the SSD into the MacBook and opt to run macOS Recovery from the Internet. To do this, hold down OptionCommandR (or, if that doesn't work, try ShiftOptionCommandR).
NOTE: If you proceed this way then:
- It may be worth you testing to make sure you can boot into macOS Recovery from the internet prior to going to the trouble of physically installing the SSD into your MacBook.
- The only way to migrate all your data is if you have a Time Machine backup on an external disk (i.e. if you don't have a TM backup and want to keep your current setup, then you will need to either make a TM backup first, or have a way of connecting the SSD or the internal drive to your Mac for migrating the data across).
Regardless, once booted into macOS Recovery, run Disk Utility to format the SSD.
Once it’s formatted you can install macOS, but how you proceed will depend on how you want to setup your Mac. More specifically, do you want to just do a totally clean installation of macOS and then install software etc as you need, or do you want to migrate your existing setup (including users/data) from a Time Machine backup?
If you're planning to migrate data from a Time Machine backup, then take a look at How to use Time Machine to back up or restore your Mac.