Are you using and purchased the right memory?
iMac (Retina 5K, 27-inch, 2017)
Get memory specifications for iMac (Retina 5K, 27-inch, 2017), then learn how to install memory in this model.
This iMac model feature Synchronous Dynamic Random-Access Memory (SDRAM) slots near the bottom of the computer with these memory specifications:
Number of memory slots 4
Base memory 8GB (2 x 4GB DIMMs)
Maximum memory 64GB (4 x 16GB DIMMs)
Use Small Outline Dual Inline Memory Modules (SO-DIMM) that meet all of these criteria:
2400MHz DDR4 SDRAM