Most rust on cast iron comes back for one reason: moisture is left on the bare iron. Keeping the pan dry, lightly oiled and stored somewhere that does not trap damp air prevents most repeat rust. A few simple habits go a long way.
Why cast iron rusts
Iron reacts with water and oxygen, and rust forms quickly when the two meet. Seasoning, the layer of baked-on oil, slows this by sealing the metal. Rust gets in where the seasoning is thin, chipped, or missing, and it spreads from there. Acidic food and long soaks can also thin the seasoning over time.
Dry it on heat right after washing
Dry the pan on a warm burner immediately after washing, rather than leaving it on the counter to air dry. Heat drives off the water that towels miss. Give it a minute or two, then let it cool. Do not put a wet pan away.
Oil it after use
Once the pan is dry, wipe on a very thin coat of oil. A cloth or paper towel works, and you should barely see the oil on the surface. This coat protects the iron between uses and helps build up the seasoning over time. Whether to oil after every use is a common question, and should you oil cast iron after every use goes through the trade-offs.
Store it dry
Store the pan in a dry place with good airflow. A damp cupboard, a basement, or a pan kept outdoors all make rust more likely. Some people put a paper towel between stacked pans to absorb moisture, which is covered in should you put paper towels between cast iron pans. For the bigger picture, how to keep cast iron from rusting in storage covers the options for long-term storage.
Signs the seasoning needs building up
If the surface looks dull, feels rough or sticky, or rust keeps returning in the same spot, the seasoning may be too thin. Rebuild it with several thin layers. Why cast iron seasoning wears off explains the usual causes, and why is my seasoned cast iron rusting covers the specific cases where a seasoned pan still rusts.