You know your pet has had an accident on the carpet (or rug) because you can smell it. The quicker you can address the accident the better, so look for spots or discolorations. However, sometimes the accident is not visible, so what do you do then? A black light can be used. Darken the room, turn on the light and scan it over the floor. You will be able to identify the urine because the urine salts become fluorescent in the ultraviolet light. However, the most available and practical method is to use your nose. Don't be afraid to get down on your hands and knees to find it.
If the spot is still wet, blot, blot and blot some more to remove as much as possible. After blotting, you can sprinkle baking soda on the area. The baking soda will help absorb the urine and also neutralize the PH of the urine. (Note: baking soda may sometimes discolor fabrics, so you should test it on a non-conspicuous area of your carpet or rug). Let the baking soda dry on the spot then vacuum it up.
If the spot is dried up, then mix 1/3 white vinegar with 2/3 water and spray it on the spot. let it sit a little bit than remove the vinegar/water solution by blotting.