From the Apple website for replacing ram in an iMac: https://support.apple.com/en-us/HT201191...
For iMac’s released 2012 onwards there is no note about the position of ram or matching pairs.
For iMac’s released 2009-2011 there is this note:
i5 and i7 Quad Core iMac computers come with both top memory slots populated. These computers will not start up if only a single DIMM is installed in any bottom slot; these computers should operate normally with a single DIMM installed in any top slot.
Core Duo iMac computers should operate normally with a single DIMM installed in any slot, top or bottom. ("Top" and "bottom" slots refer to the orientation of the slots in the pictures below. "Top" refers to the slots closest to the display; "bottom" refers to the slots closest to the stand.)
There is a number of comments to say you should stagger the ram and make sure i=identical ram modules share the same DIMM number, not the same BANK number. How to couple RAM Modules in iMac 27?