Here's how it works:
1. Differential Erosion: Coastlines are rarely perfectly uniform. There are areas of harder rock (like granite) and softer rock (like clay). Waves erode the softer rock more quickly, creating bays and inlets.
2. Headlands Remain: The harder rock areas, which are less susceptible to erosion, stick out into the sea. These are the headlands.
3. Further Erosion: The waves continue to erode the softer rock areas, making the bays and inlets wider and deeper. This further emphasizes the headland's prominence.
Therefore, headlands are formed by the selective erosion of softer rock, leaving the resistant harder rock areas exposed.