Blackheads (also known as ‘open’ comedones,) occur when oil and bacteria have been trapped under the skin, causing an inflammatory, healing response. This is a form of acne. As the skin over the spot breaks, the contents become exposed to the air and oxidises which turns the contents of the spot black.
Science: Keratin (another word for skin debris) combines with sebum (oil on skin) to block the hair follicle. A comedo can be open (blackhead) or closed by skin (whitehead), and occur with or without acne.