Warts occur when the virus comes in contact with your skin and causes an infection. Warts are more likely to develop on broken skin, such as picked hangnails or areas nicked by shaving, because the virus is able to enter the top layer of skin through scratches or cuts.