Bacteria may be tiny little micro-organisms but like any other living creature there are certain molecules that they need for survival. No matter what niche a bacterial colony occupies, it eventually requires a source of iron. For bacteria that live within the human body, there is one incredibly iron-rich molecule that circulates throughout the human body and can be found permeating the tissues.
Haemoglobin - the molecule that gives blood its red colour and is used to transport oxgyen through the body.
The image above (credit link) shows the structure of the haemoglobin molecule. It consists of four sub-chains (shown in red and blue) each of which carries an iron containing "haem co-factor" which you can just about see in the diagram as the spikey green things. These haemoglobin molecules are packed tight into red blood cells, so tightly that the red blood cells don't even have a nucleus but are just haemoglobin carrying machines. The lack of nucleus means that they can't grown or divide (or do anything much), so after being put together in the bone marrow and circulating the blood for around three months red blood cells are discreetly removed and replaced.
All of this circulating iron is a great opportunity for pathogenic bacteria, who have developed various systems to get hold of it. Firstly they have to break down the red blood cells, usually by secreting various chemicals that break up the cell membrane, releasing the haemoglobin. Then they have to bind to the haemoglobin via specialised receptors on their cell surface. Once bound, the haemoglobin passes through the bacterial cell wall and into the interior of the cell. For bacteria with two cell membranes (Gram negative bacteria) this is a complex task involving various different proteins, transporters, and use of the proton-motive force. For bacteria with one large thick cell membrane (Gram positive bacteria) some sort of protein relay process seems to be involved, which uses far less energy. Greater detail on both these processes can be found in the references below.
Once inside the bacterium, the haemoglobin is broken down to release the precious iron that it carries. This is more dangerous than it sounds, because the iron in haemoglobin is carrying oxygen, which means that there is potential for reactive oxgyen species to be released and cause havoc inside the cell. Not only that but in some bacteria the "haem co-factor" itself can be toxic. Some bacteria contain special enzymes called "Haem oxygenases" which deal with the oxgyen species, while others sequester the haem in vacuoles away from the rest of the cell, or turn on exporter molecules. It's not quite clear whether the exporters are taking away the haem or some other toxic product, but they are vital for preventing the toxic effects of haemoglobin within the bacteria.
The whole process of extracting iron from haemoglobin is actually fraught with dangers for the bacteria. The process requires all sorts of special molecules and transporters which don't feature in human cells, which makes them a prime target for the immune system to recognise an invading element. In particular the haemoglobin binding proteins, which are a bit like a large red flag labelled "invader" sticking out of the bacterial cell surface. Not only that, but they are quite energy expensive to run, particularly for the Gram negative cells. In consequence, the bacteria tend to only activate this system when they are running particularly low on iron, and there are no other available sources around.
Ref 1: Pishchany G, & Skaar EP (2012). Taste for blood: hemoglobin as a nutrient source for pathogens. PLoS pathogens, 8 (3) PMID: 22412370
Ref 2: Pishchany, G., McCoy, A., Torres, V., Krause, J., Crowe, J., Fabry, M., & Skaar, E. (2010). Specificity for Human Hemoglobin Enhances Staphylococcus aureus Infection Cell Host & Microbe, 8 (6), 544-550 DOI: 10.1016/j.chom.2010.11.002