I put a treat behind the bell, and then gave him the treat once he rang it.
Then, told him what a good boy he is, and then took him out. Small treat, consistently, every time he went out. And then one day, I heard the bells ring on their own ... he made the associate that the bells mean he gets to go outside.
Now, I must warn you that when they first learn this, they don't necessarily associate going out with going to the bathroom, but might ring just to go chase leaves and squirrels. I still struggle with that a bit, but now Lucky mostly just does it if he really has to go out. And he'll be persistent about it as well.