What determines the color of a pure substance and is it possible to predict it? I have always wondered why salt is white, water is clear and gold is, well, gold. What determines the color of a substance? Does it have something to do with the electrons? And is it possible to predict the color of a substance by looking at the formula?
 A: It's important to note that color is only defined given knowledge of three things, see especially this section of the wikipedia article which has a nice discussion.
1) Light absorbing / reflecting properties of a material
2) Properties of the light source
3) Properties of the human perception of light
In general, 1 is determined by the interaction of the electrons in the material with varying frequencies of light, see e.g. absorption spectrum for one thing that goes into it, but there are other properties like reflection that I won't go into.
2 is determined by the spectrum of the light that goes in.  For instance, things will have a different perceived color under moonlight or sunlight or under mercury lamps.
Finally, 3 is mainly determined by properties of the human color receptors in the eye, but also there are perceptual issues coming from how the brain processes visual information; you can sometimes see this in various optical illusions.  Note that this too can vary from person to person, indeed some people are color blind or have color receptors for 4 basic colors, not just the usual 3, see e.g. tetrachromat.
Again, the wikipedia page on color goes much more into detail on all this.
A: Yes, it is possible to predict the color of a substance, but it is, in some cases, very complex. 
The color of a substance is decided at various levels. The most "trivial" level is the molecule in gas phase. You have a molecule, all by itself, and when you send some white light on it you provide all the colors of the spectrum. The electronic configuration of the molecule is such that it "prefers" specific light frequencies (hence, specific light colors). This preference is due to the electronic transitions between a ground state and an excited state, which is then "quenched" as heat. As a consequence, the molecule absorb some colors, thus subtracting them from the white light. What you see is the complementary color. If the molecule absorb blue, you get red. If it absorb yellow, you get violet.
Electronic transitions, however, are not the only responsible for absorbing light. A molecule can absorb by excitation of rotation and vibration (meaning that the molecule spins faster, or vibrates more). One case is water. Water appears as transparent, but in reality it's slightly blue. The reason is that you are exciting it vibrationally (to be exact, there's an absorption in the red which is an "overtone" of a vibration which actually absorb in the infrared). As a result, a minimal amount of red is subtracted from white light and water ends up being slightly blue.
Molecules however are not alone in the universe. They can come close, and eventually have other molecules around, either of the same species, or of other species, such as those of a solvent. No reactions are involved, just the proximity of other molecules, with their protons and electrons. The presence of nearby partners alters the electronic setup of the molecule, and as a consequence, a slight variation of the absorption is produced, leading to a change of color, either as a shift towards blue or red.
Then you have anything that can change the structure of the molecule through chemical reaction. Take tea, put some lemon into it. Its color becomes lighter, because you are increasing the acidity of the water, and the colored substances in the tea receive the H+ protons, creating a change in the molecular electronic distribution. The result is a different color. This effect can be dramatic: from blue to red, from transparent to purple. These are the so-called pH indicators.
Then you have the crystals. When you have ordered atoms, they can absorb light by virtue of their ordered crystalline structure. Note that the starting atom or molecule, by itself, may absorb nothing in the visible, so it would appear "transparent", or white. Nevertheless, it's by virtue of the highly ordered crystalline structure that, in the end, what you handle with your hands absorbs light, and thus has a color. This, at the quantum level, has to do with band structure and Bloch wavefunctions. The same fact explains semiconductors and conductivity of metals. How the atoms (or molecules) are arranged in space, and how many you have makes a difference in the final color. You say gold has gold color, but if you take a small cluster (say, 100) of gold atoms, what you see is red, not gold-colored. As a side note to crystals, you have impurities. Take aluminium oxide, it is transparent. Add some Chromium Iron and Titanium and it becomes Ruby, which is red, or sapphire, which is blue, depending on the crystal structure, and the relative quantities of these impurities.
Then you have how the substance is structured at the macroscopic level. Take a smooth platinum electrode. It's platinum color. Make it sponge-like (by making very tiny bubbles and pits) to increase the surface area and it appears black as coal. This is because the light is scattered and absorbed completely, leading to a black color. 
Potentially, you have additional effects perturbing matter-light interaction. What is the color of a CD ? is it silver ? is it "rainbow" ? What about the color of a oil slick on the road in a rainy day ? What about the color of opal, or of a tiger eye ?
As you see, color is a very particular property, and while you can make an educated guess (in particular through quantum mechanics techniques) it's not always easy to know what color a given substance can have. This is just the tip of the iceberg. You have many other phenomena (such as how much light penetrates into the substance, or what imperfections are present) which affects both the color and the reflective properties of a substance. Ice is transparent, but if it's full of bubbles it's white. Plastic looks like plastic, and metal looks like metal, because how the light is scattered and absorbed changes the way light is reflected back to the viewer. This however, does not affect only color, but the general material texture. Pure spectroscopic color for white, non-polarized light is probably what you are referring to.
So to answer directly:

What determines the color of a substance?

many different things.

Does it have something to do with the electrons?

Yes, in some cases, electrons are "excited", leading to absorption of some light frequencies, but it's not the only factor.

And is it possible to predict the color of a substance by looking at the formula?

In general, no. But you can, from personal experience, know if a substance is colored or not, and more or less in which part of the spectrum it will absorb. To have a more accurate answer, you need a course in computational chemistry, because you need a program, a computational method, and a good dose of skills to get it out. In any case, the required input is just the xyz coordinates of the atoms and their atomic numbers.
A: The light is just a kind of electromagnetic radiation. You can see it, but it is the same phenomena as X rays. So, when this electromagnetic radiation, light, arrives at a material, the electrons of this material are driven by light. It depends on how are arranged these electrons, their energy... the way they will be driven. 
Thus, electrons, as charged particles, in a movement which is imposed by light, begin to radiate themselves. And this new radiation is the characteristic light reflected by the material, with a well-known frequency (a range of frequencies actually).
In some simple cases it is possible to predict exactly the way the material will reflect (re-radiate) light, and to know the color. 
