When in a UCI race, does the helmet have to be to be fitted properly I noticed that Nibali's helmet was very loose when he went down during one of the last stretches of the 2016 Giro d'Italia. A helmet is almost useless if it's not properly fastened. I understand that the pros loosen their helmets on the uphill to breathe more easily, but is there a rule about wearing it properly when at high speed?
According to UCI's official regulations

Section 1.3.031

(emphasis mine)


  
  Wearing a rigid safety helmet shall be mandatory during competitions and training
  sessions in the following disciplines: track, mountain bike, cyclo-cross, trials and BMX,
  para-cycling, as well as during cycling for all events.
  During competitions on the road, a rigid safety helmet shall be worn.
  During training on the road, the wearing of a rigid safety helmet is recommended. 
  UCI CYCLING REGULATIONS
  E0616 GENERAL ORGANISATION OF CYCLING AS A SPORT 74
  However, riders must always comply with the legal provisions in this regard.
  Each rider shall be responsible for:
  
  
  ensuring that the helmet is approved in compliance with an official security standard
  and that the helmet can be identified as approved;
  wearing the helmet in accordance with the security regulations in order to ensure full
  protection, including but not limited to a correct adjustment on the head as well as a
  correct adjustment of the chin strap;
  avoiding any manipulation which could compromise the protective characteristics of the
  helmet and not wearing a helmet which has been undergone manipulation or an incident
  which might have compromised its protective characteristics;
  using only an approved helmet that has not suffered any accident or shock;
  using only a helmet that has not been altered or had any element added or removed in
  terms of design or form.
  
  


By the letter of the law, Nibali could be punished for loosening his helmet strap at any point in competition.  Interestingly, USA cycling's regulations further clarify that "any point in competition" includes ANY time you are on a bike at an event, including warming up prior to race start and cooling down after the finish but before any awards ceremony (riding on rollers and trainers is exempt, however).

In reality I don't forsee any UCI officials wanting to punish one of the sport's premier athletes over something so minor; no one benefits by doing so, but it would cause anger and resentment amongst Nibali, his team, sponsors, and fans.  In the end, sometimes you have to pick and choose your battles.

That said, don't follow Nibali's lead here.  Wear your helmet properly or, as you say, it's entirely useless (not to mention, assuming you are not a WorldTour rider, you ARE liable to get disqualified by an overzealous local official).