Phosphenes

Phosphenes are sensations of light (typically flashes) which appear as a visual sensation - but without any light input to the eye.

Because they are relatively common, and occur naturally, they have been studied since the time of Ancient Greece (Isaac Newton also investigated them).

There appear to be various types - e.g. diffuse flashes, bright spots following a path ('Seeing Stars'), glows etc etc.

It's possible that the different types have different origins - for example, some may be coming from the retina itself, whilst other varieties may be purely brain-generated. (fMRI studies have shown that they often originate in V1, the primary visual cortex, and V2/3, the extrastriate visual-cortical areas).

Phosphenes may be 'induced' by various means - such as pressure-rubbing of the eye, rapid blood pressure changes, electrical and magnetic brain stimulation, sneezing, laughter, blows to the head, disease, drugs, meditation, etc. etc..

In no case is there an agreed explanation of the cause.

See : Wikipedia