Cycling headwear comes in a variety of different variations, including sweatbands, cycling caps, cold weather hats, and even balaclavas.
Sweatbands are generally used during the summer time to keep the sweat out of your eyes while mountain biking in hot conditions. Cycling caps are designed to fit under a bike helmet and keep the sweat away like a sweatband, but they also help keep the sun out of your eyes.
When the weather gets cold, nothing beats a cycling-specific beanie. These are generally low-profile beanies that fit easily under your helmet, yet still keep your head nice and warm during the winter. If conditions get really cold, throw on a facemask or balaclava to really keep the wind away.