I want to buy a new iMac: Link
And I need to upgrade the RAM. How do I know wich RAM is compatible with the iMac, for example: This RAM
I've used Crucial website for all my Mac upgrades and never had a problem.
You can specify which model you want to upgrade and it will give you all the available (safe) upgrades.
In this case: Link
Alternatively you can navigate to the Apple logo on the upper left side of your mac and select About this Mac. Then select the Memory tab and check the specifications for the RAM modules.