When I booted into recovery mode, and used the disk utility, I saw that in addition to the SSD I had added, there was another disk, something like "Apple SSD PCI-E..." that was present, but unused. I deleted this drive and re-booted with my monitor attached, and it is now working. The USB-C ports are now working fine for me.
+
My iMac (21.5 inch 2017 model, 3.4 GHz) had a fusion drive, and I upgraded the ram to 32 GB and replaced the 1 TB drive with a 500 GB SSD. Using Apple's instructions for fixing a fusion drive (https://support.apple.com/en-us/HT207584), I merged the "blade" drive and the SSD into a new fusion drive. I then restored from a Time-machine backup, and reset the PRAM and SMC.
+
+
The USB-C ports did not work with my external display when I used a USB-C to HDMI adapter and cable that had worked before, but when I tried another adapter, the problem was resolved. Both adapters were supposedly exactly same, as I had purchased one for my iMac and one for my laptop (https://www.amazon.ca/ICZI-Aluminum-Thunderbolt-Compatible-ChromeBook/dp/B01MT44TQS/ref=sr_1_4?s=pc&ie=UTF8&qid=1512648904&sr=1-4&keywords=usb+c+adapter), but only one worked. The adapter and cable that you are using to attach to your monitor may be the issue.
When I booted into recovery mode, and used the disk utility, I saw that in addition to the SSD I had added, there was another disk, something like "Apple SSD PCI-E..." that was present, but unused. I deleted this drive and re-booted with my monitor attached, and it is now working. The USB-C ports are now working fine for me.