CPU cooler has to:
- fit into motherboard socket - so if you have say 1151 socket motherboard, you need cooler that supports 1151 socket. Luckily, pretty much all new coolers are built to accommodate all existing sockets.
- has enough cooling power (TDP) to keep your CPU cool under load.