Apple's official line is that the revamped iMac line tops out at 32GB of RAM. However, OWC says some models can handle 64GB .
OWC has announced the first 64GB support for the new iMac with 27-inch Retina 5K display via their MaxRAM certification program. In addition to kits now being offered for up to 32GB utilizing 4GB and 8GB modules, OWC will shortly begin offering kits of 32GB, 48GB and 64GB, utilizing modules of up to 16GB per slot for up to double the maximum memory offered via Apple factory options.
Note that only the newly introduced “Apple iMac with 27-inch Retina 5K display Late 2015” models with model ID 17,1 are able to support these higher memory configurations. Prior iMac 27-inch with Retina Display models support a maximum of 32GB.
The 64GB upgrade won't be cheap; it's US$1,195. Also, be aware that the new 4K 21.5-inch iMac uses soldered RAM, so you're pretty much stuck with the 8GB or 16GB that you order with the all-in-one.