Hemoglobin binds oxygen by rusting on the atomic level. The hemoglobin molecule in red blood cells is what the U.S. Department of Energy's Office of Science calls a "metalloprotein." That is, it is a protein that incorporates some metal, iron in this case, into its structure. Each hemoglobin molecule carries four bound iron atoms that work cooperatively to carry oxygen from the lungs, where it is abundant, to other parts of the body.
According to the National Center for Biotechnology Information website, the iron atoms carried by hemoglobin react to the presence of oxygen the same way iron usually does, by bonding with it in a process called oxidation. The resulting compound, iron oxide, is called rust when it is found outside the body. Inside the red blood cells, these oxidized hemoglobin molecules hold onto their oxygen cargo until they get to a part of the body that does not have enough oxygen, where it is then released.
The same article notes that the four subunits of the hemoglobin molecule work together to bind oxygen very efficiently in oxygen-rich environments, but the effect weakens in oxygen-poor environments. This uneven reaction makes hemoglobin eager to bind with oxygen in the lungs and just as eager to part with it in the presence of an oxygen-hungry cell, whereupon the cycle starts over.