Physical mechanisms of generation of coherent radiation in an ultrarelativistic free-electron laser