They serve a lot of different functions, probably the first is to give some depth and texture to the scene. You would ordinarily install lighting for each area of the stage from several directions. Minimally front, side, and back or top lighting. The different directions keep the actors and the set from looking flat, and using different colors from each direction makes it all easier on the eye. The different colors can also help to denote time of day and set an emotional tone. They may also simulate light from sources like lamps on stage or an imaginary source like the sun or an off stage lamp. Another reason is to make one color the predominant light on the actors skin and costumes while using another color to set off the colors on the set. Front light will often use a fairly neutral color, sometimes a warm amber or pink to make skin look nice and for happy scenes, sometimes a color correcting blue to make it a little more like daylight, sometimes a more blue color for night or sad scenes. Top or back light and sometimes side light will often have a deeper color to set the mood or to show off the colors on the set. Then when each scene is put together any combination of these can be mixed together to produce the look the designer and the director want, often in ways that were never planned. The audience usually doesn’t consciously notice a lot of what goes on in lighting, but it is important in setting mood and focusing the audience’s attention nevertheless. Your eyes would get very tired at the end of the show if the lighting never changed, and you would likely have a less emotional experience.