That's an excellent and practical question for keeping our cities clean. The "best" lock often depends on your specific nuisance—raccoons, stray dogs, or people—but a few mechanisms stand out for urban environments.
For general animal resistance, a simple but robust metal latch or clasp is highly effective. Look for bins with two sturdy latches on opposite sides, requiring opposable thumbs to open. This deters most clever animals like raccoons. Combining this with a foot pedal mechanism that only opens the lid when depressed is a classic, hands-free solution that keeps the lid securely closed otherwise.
If human scavenging or vandalism is the primary concern, you need a step up. Integrated key locks or combination locks built into the bin's design are the standard. For high-security areas, tamper-proof bolts that require special tools to open can be used to secure bins to fixed poles or the ground, preventing both access and theft of the entire container.
Recently, smart locks have entered the space. These can be opened via RFID chips for authorized waste collection crews only, providing the highest level of controlled access. However, they are more costly.
The most reliable solution is often layered. A bin secured to a fixed spot with a tamper-proof bolt, featuring a sturdy latch-closed lid operated by a foot pedal, is incredibly tough for both animals and humans to breach. The goal is to make accessing the bin more trouble than it's worth, directing scavenging behavior elsewhere and maintaining a tidier, more hygienic streetscape for everyone.