If your SSD is PCIe it will use the PCIe protocol when slotted into the M.2 slot. This has the advantage of higher transfer speeds, and if the drive is an NMVe one it will also be much more responsive, with the downside of extra cost. A perfect example of this (and the M.2 drive of choice for many enthusiasts) is the Samsung 950 Pro.
If the SSD is M.2 SATA, it will use the SATA protocol when slotted into the M.2 slot. This limits it to about 600MB/s transfer speeds. They are also usually cheaper. An example of such an SSD is an M.2 Samsung 850 Evo (they also come in mSATA and 2.5" form factor).
For the most part it is recommended not to use M.2 SATA SSDs because you'd be wasting M.2 slots.