To clarify. As noted above, on a stage with an uphill finish, riders can only get rid of their helmet on the final climb. The rest of the stage they have to wear it. If you watch you'll see a kite on the side of the road indicating when they can take it off.