In the real world, the light comes from one main direction. This is the rule. Even if you are outdoors, the light from the sun comes at you from East to West. Depending on where you are during the day will determine where the shadows are. This is the same with painting.
You must always determine where your light source is coming from. Once you have done this, keep it consistent. It will show quickly if you have a subject standing on one side of the canvas with the light dancing off her hair from the left and on the other side of the canvas, the table has light streaming in from the right.
You can help to keep the light source in the proper perspective by setting a light where ever you are going to have it shine from. If you choose to have the light source come from the right of the painting, then set light to the right of your canvas. Keep the light source in your studio the same as the light source in your painting. This can assist you in keeping shadows where they need to be and reflective light where it should be.
As you become more familiar with the painting you may not need this technique so much. It is just a simple way to keep everything flowing in the same direction. It helps to keep the visual reality.
The light source will fade as it travels across the canvas. In some paintings, it will fade quickly. This will depend on the subject and type of painting you are doing. You may want to splash a sunset across the canvas. There will be shadows and dark ones, where the light source starts to fade. To understand how crucial lighting is in a painting, set up a still life on a table. Nothing fancy, just a few pieces of fruit in a bowl or a vase of flowers will do. Now get a bare 60-watt light bulb to set around the table. Start on your left. See where the light glistens off the surface of the subject. Notice where the shadows are. See how the light fades across the scene. Move the light to the back, front, and other sides to notice all the angles. This will give you a good idea of how light works on a subject. You can even simulate high noon by suspending the light bulb from up above. Placing a sheet or other translucent material between the light and the table will show you the effects of an overcast day or diffused lighting.
You can become familiar with lights and shadows the more you do this. By using different test models, you will begin to understand how curves, reflective surfaces, and other things can affect light. This will enable you to capture it more accurately on your canvas.
If you thought all you needed to do was buy some paint, a brush, and a canvas to start painting you were right. To be really good at it takes some thought and planning. Even a few exercises in technique will be necessary to create a good work of art.