Chosen Solution

Hello dear internet friends! I have a problem with my 2013 21.5inc i5 iMac, it started to make clicking sounds. First I thought that it is HDD, so I replaced it (still needed to do so), sound stayed. Next moving part is fan, also replaced it, still sound is present. Sound can be reproduced by running load on mac, if you tilt imac to the right it gets louder, if you tilt to the left it stops. If you turn it off and shake, no rattling sound is present.  Question would be is it possible to make some load on mac while you have screen taken off? Maybe this way I would be able to at lest see from where the sound comes.

It was the heatsink! I still can’t believe this, it has no moving parts, but made such a loud clicking noise. After replacing it, my iMac got back to normal temperatures and sound is totally gone

I use a stethoscope to help locating anomalous sound issues.