First, figure out whether the bin belongs to you or to the city, your landlord, or a waste management company. If it is a city-issued urban trash bin, do not drill or modify it yourself. Call your local sanitation department or 311 and ask about a replacement lid or a service request. If the bin is yours, look for a brand or model sticker on the back or inside the lid. Measure the lid width, depth, and hinge spacing, and take clear photos of the hinge setup so you can order the correct replacement lid.
Once you have the new lid, put on gloves and clear the area around the bin. Open the lid and inspect the hinge. Some bins use screws or bolts, while others use push-in pins or rivets. Remove screws with the right screwdriver, and pull out pins with pliers. If the hinge is rusty, spray a little penetrating oil on it and wait a few minutes. Avoid forcing plastic parts, especially in cold weather, because they crack easily. If the hinge is riveted and the bin is still under warranty or owned by the city, stop and let the responsible party handle it.
Line up the new lid with the hinge holes, slide the pin or bolt through, and tighten it snugly but not so tight that the lid binds. Open and close the lid a few times to check the alignment. It should sit flat enough to keep rain out and help keep animals from getting inside. If the new lid came with different hardware, use the hardware that matches your bin rather than whatever is easiest. Finally, dispose of the old lid according to your local rules, and test the bin a few times before putting it back out for collection.