This is called hypnagogic hallucinations, hypnagogic images or sleep images.
Hypnagogic hallucinations are normal
|Phosphenes, as they usually look to me
The first and simplest kind of hallucinations is called phosphenes. When there is no visual input from the eyes, background noise from the nervous system will become visible as shapeless blobs of light. For me, they are usually blue or green. Staring at the darkness for a few moments is usually enough to induce the hallucination, and the longer I focus on it, the stronger it becomes.
This isn't necessarily a sign of falling asleep. Phosphenes can have other causes, such as pressure (for example from rubbing your eyes) sleep deprivation, or fever.
Visual hallucinations are common while falling asleep. After intense activity, especially after learning a new skill such as a computer game, visual hallucinations can be very detailed copies of the activity. This is called the Tetris effect. Other common themes are text or headlines, shifting patterns, landscapes and work scenes. Maybe my most common visual scene is the workbench in the flower shop where I work. It is welcome, because it simply means that I'm falling asleep. For a person with periodic insomnia, this is a relief.
All senses can be affectedThe hallucinations aren't necessarily visual. It is just as normal to experience sounds and physical sensations. I have been lucky enough to hear music several times. The music can be a well known song, or it can be completely new. Some people hear their own thoughts spoken by their own voice. Footsteps, the doorbell, or a phone ringing are commonly reported sounds. Some people may experience an extremely loud noise. This is known as exploding head syndrome. It is rare, and harmless.
It can feel like the body is being stretched, compressed, lifted up or vibrating. I sometimes feel like my hands are floating in thin air. Some people have even reported smells or tastes. I know that I have hallucinated the smell of smoke at least once.
The hypnic jerkA specific kind of hallucination can actually be so disturbing that we wake up. It's a startle reaction called the hypnic jerk. It feels like a "jump", and is usually accompanied by hallucinations of falling or slipping. For me, it usually feels like I fall "through the ground". This is apparently more common in stressful periods. Sometimes, after sleep deprivation, this is how we can notice that we are actually falling asleep in the day.
Hypnagogic hallucinations and lucid dreaming
|Many of my lucid dreams start with this
For people who practice the WILD form of lucid dreaming, the hallucinations are valuable. They are a good sign that the body is actually falling asleep. The hallucinations can transform seamlessly into a dream. The trick is to stay focused on the images, while still allowing sleep to happen. This will usually take some practice.
For me, the best hallucination to get a WILD from is an image of a road or path. It feels easy to concentrate on. I imagine moving along the path, and at a certain point, the illusion shifts from 2D to 3D. When I stand on the road, the lucid dream has started.
For learning more about lucid dreaming, I strongly recommend paying a visit to LD4all. I have learned so much from the people there.