To type accents over mathematics, such as hat, first change to Maths mode with Ctrl-M (or Cmd-M on Mac), then enter the character:
Right click on the character, and select Properties - Character Properties, then choose the accent required and click OK:
or or , etc.