Selling property with multiple agents

Hello, does anyone know what are the laws of selling property with multiple agents. I often see one property for sale by multiple agencies and I assume that the agent fee is paid to successful agent. But I’ve heard few stories when other agencies demanded their fees even if they didn’t sell the property, for example if buyer contacted them but went with other one instead. How can seller protect himself? TIA