Head flashing is sometimes referred to as Z flashing. The purpose of this type of flashing is to direct water away from the house. When windows are installed, part of the window protrudes from the siding. When water flows down the wall, it hits this protrusion and flashing is needed to keep water from flowing into the house. In the diagram to the left you can see how the flashing is behind the siding and goes over the top of the window. Although some windows have this built into them. most do not. The vinyl windows are the most common that have flashing installed. This is usually a J-channel the is built into a window. But this blogpost is about head flashing and not the J-channel.
Head flashing is not always required. If a window is not subject to having water flowing down from above, then this flashing not required. The rule is shown in the diagram to the right. If the distance from the bottom of the ceiling to the top of the window is less than 25% of the overhang then the head flashing is not required.
Very little of the flashing is visible from the finished window. There will be a small metal (sometimes plastic) strip that travels along the top of the window. On the gray house, there is only J-channel along the top of the door. Even though the top of the door is caulked very well, water still entered the door and rotted the bottom. The green house has the head flashing and water is kept from damaging the door and the structure.