The most common place I see these is around metal chair or table feet that have been placed on wet carpet or had water spilled on the carpet near them.
The normal carpet cleaning options and chemicals won’t pull iron out (or red dye – separate post) so you need to get a specialized iron removal chemical. janitorial supply distributors will have them, maybe some drug stores and carpet stores as well.
1) Follow label instructions.
2) Note with special care the instruction for removing or neutralizing the residual chemicals you don’t extract with the stain. Iron removal requires acid. Acid strong enough to destroy your carpet. Unless you completely remove the chemical you risk permanent damage to your carpet. We are forced to use “hot” acids to remove iron stains from toilet fixtures and sinks – while not as aggressive as these acids, this stuff still doesn’t belong in your carpet long term.