Why a toilet keeps running
After each flush, the flapper (or seal) drops back onto the flush valve to close the bottom of the tank, and the fill valve refills the tank until its float rises and shuts the water off. A toilet runs when one of those doesn't close: the flapper leaks or is held open by the chain, or the fill valve keeps letting water in so it spills down the overflow tube. Either way, water flows into the bowl and down the drain.
A leaking toilet can waste a lot of water without you noticing, which is why EPA WaterSense suggests checking for silent leaks at least once a year.
Flapper toilets and dual-flush cisterns
Many toilets in the US have a rubber flapper on a chain. Many newer toilets, including dual-flush cisterns with push buttons that are common in India, use a canister-style flush valve with a rubber seal instead of a flapper. The same tests apply, but the seal and its parts are specific to the model, so find the brand and model (often printed inside the tank) before buying parts.
Ghost flushing
If the toilet refills briefly on its own every so often without anyone using it, that is usually a slow flapper or seal leak. Fluidmaster notes that the dye test can miss very slow leaks: turn off the supply, mark the water level, and check later. If it has dropped, water is escaping into the bowl.