Why do some animals have blue blood?

Science fiction writers use blood that isn’t red to emphasise the extraterrestrial, but you don’t have to go into space to find species with blue or green blood

Among the former here on Earth are octopuses and squids, while the name of Papua New Guinea’s green-blooded skink speaks for itself. Human blood is red because it contains the oxygen- carrying molecule haemoglobin. Blue-blooded octopuses use haemocyanin instead of haemoglobin because it keeps working at extreme temperatures. The chemical responsible for the green-blooded skink’s peculiar shade of plasma is biliverdin, a by-product of the breakdown of
haemoglobin. The ocellated icefish is another oddity where blood colour is concerned; it has neither haemoglobin nor haemocyanin in its blood, which therefore has no colour.