How often should a bicycle chain be replaced?

Measure with a chain checker every 500 km.

Replace at 0.5 percent wear and the cassette will last twice as long.