Here's what happens.
Stains occur due to seepage of moisture through very small (and sometimes invisible to the naked eye) cracks in the glaze often referred to as crazing, crackle or pin holes.
Moisture combined with organic matter: tea, coffee, oil, fat, food and dust evolves into a bacteria that typically is brown or black in colour present between the glazed craze lines or in the clay body under the glaze. Scrubbing the surface is a cosmetic fix only.
Bacteria stains are more likely to occur on earthenware or stoneware type pottery due to the ceramic higher porosity level allowing the moisture to penetrate deeper and stay wet creating a perfect environment for bacteria to flourish. High fire ceramic such as porcelain, which has almost no porosity is less likely to stain but still will.
Crazing and crackles are a network of lines or cracks in the fired glazed surface. They usually occur at the end of the kiln firing process when the outside surface cools before the clay body under the glaze cools. Crazing can also happen during the vessel's life time due to rapid temperature changes: day and night, hot and cold water.
Do not use bleach or chlorine. Bleach or chlorine may remove the surface stains but also can damage the ceramic item more. You can use OXY cleaners for mild staining but anything that black, I’d bin too as the bacteria is too deep in the crazing and will continue to multiply.