Pull the SATA data cable connector away from its socket on the logic board.
The SATA connector on most iMacs tends to stick in its socket on the logic board. If you are having trouble disconnecting the SATA cable, insert a metal spudger or any other thin tool into the gap between the SATA connector and its socket and twist the spudger's shaft to safely separate the two pieces.
Lift the left and right speakers out of the rear case.
The speaker cables are still attached to the logic board.
The right speaker cable may be routed under the power button cable or the CPU fan cable (or both). If so, disconnect both cables by pulling their connectors away from the face of the logic board.