Modern cartoons show the halo as a sort of neon circle that floats over the head, but in ancient times, and in historic Christian art, the halo is a stylized backlighting effect. Before the Christian era, artists used halos to help the viewer identify the important people in the picture. In an age without photography, that was necessary.
Originally, halos were blue and surrounded either the head or the whole body. Christian halos generally surround only the head and can be almost any color. At home I have a modern Orthodox icon of Jesus at His Resurrection, showing Him with an oval blue halo around His entire body. On my desk at work, I have a small icon of Jesus with His head surrounded by a circular golden halo with a red rim.
The halo did not come into Christian art until the third century, after it had largely fallen out of general use. In early Christian art, only Jesus had a halo, whether He was depicted as a man or symbolically as the Lamb of God. By the fifth century, halos were used for angels and saints as well. Artists used circular halos for angels, and deceased saints, but gave rectangular halos to living people who were regarded as exemplary in their faith. Jesus received a special circular halo that was unique to Him.
But what moved Christian artists to adopt the artistic convention of the halo? Perhaps early Christian artists felt that it depicted a real phenomenon:
About eight days after Jesus said this, he took Peter, John and James with him and went up onto a mountain to pray. As he was praying, the appearance of his face changed, and his clothes became as bright as a flash of lightning. Two men, Moses and Elijah, appeared in glorious splendor, talking with Jesus.
—Luke 9:28-31a, NIV
Imagine painting a picture of that without some sort of halo!
I have read modern Orthodox accounts, in which people have reported seeing actual halos around living people who later turned out to be great saints. So halos are more than just an artistic device, they are the stylized representation of a real phenomenon. According to Orthodox authors whom I have read, the halo is the Uncreated Light of God that even our physical eyes can sometimes see surrounding those who walk in the light:
This is the message that we have heard from him and declare to you: God is light; in him there is no darkness at all.
—1 John 1:5