iMac making strange electrical clicking noises
There are only a few components in an iMac that can make clicking noises.
It's highly unlikely that it's your logic board or a component of your logic board, but the possibilities are:

Power Supply
Hard Drive
Speakers
CPU Fan

I've included a sample picture and the location of the components in the picture below


Power Supply
There are a number of components on the power supply that could be at fault here from capacitors, transformers, relays, etc.  I have provided the posterior view (what you are seeing in the top picture is the anterior) of the power supply

Hard Drive
You said you only have a 256GB SSD, so, it's unlikely that you have a traditional spinning hard drive, but, to make sure, issue the command diskutil list in Terminal and post the output
Speakers
It's not out of the realm of possibility that you have a malfunctioning speaker(s).  Try turning off the sound or better yet, plug in a headphone so it forces output to that device.  if the sound goes away, it will be something associated with your speakers
CPU fan
You said that the sound was more &quot;clicking&quot; than a whir or a hum.  However, it is still possible that some debris is interfering with the operation of the fan or it may be a defect in the motor.

How to fix
Based on your comments, I tend to agree that the power supply is the culprit given that it persists when the display is off or even while sleeping.
The good news here is that these components are relatively inexpensive. A quick search on Amazon  yields the power supply for about $120.  I have bought from this vendor for my own iMac and had good results (I am not affiliated with them).
The best option, if you don't have the tech skills to open this up is to have a pro take a look at it.  Be sure to include the video you linked in your comments.