WHAT IS THE USE OF A LENS HOOD?

For nikon lens 18-55mm

It prevents stray light from causing lens flare and ghosting

Incident light hitting the lens elements can produce visual artifacts, Using a lens hood helps prevents incident light. Lens hoods can also help protect the front element of the lens from damage. I've a 70-210mm f/2.8 lens with a totally trashed original lens hood, but the lens remains fine!

As well as the real reasons stated above, the hood also makes the camera look a hell of a lot better!

The lens hood is for preventing the sun from shining on the surface of the lens, it helps prevent lens flare.

Avoiding indirect light

They help prevent flare which reduces contrast, they offer some mechanical protection, much more than a 'protection' filter will. All Pro photographers automatically use them.
Only Canon and Nikon charge you extra for one, most other manufacturers include them when you buy the lens.
USING CAPITOLS IS CONSIDERED SHOUTING - bad web etiquette.