When an object is illuminated by the sun, how does the reflected spectrum change? Does each surface has an own reflection spectrum? where each photon "checks" its wavelength and "decides" to reflect or absorb?
Yes, this is more or less correct. But when dealing with very many photons, striking very many different atoms/molecules mixed together into one material, we observe that some fraction, or percentage if you like, of the photons are reflected. So, the spectrum is made up not of yes-or-no, but that fraction, for each wavelength. This is called the surface's reflectance spectrum. You may also hear “diffuse reflectance” or “albedo”.
(“Diffuse” means the reflection happens at a random angle, usually due to roughness or translucency of the material; its opposite is “specular”, mirror-like reflection. When an object gleams and sparkles, that is specular reflection. Most objects exhibit some of both, and the specular reflectance can have a different color/spectrum than the diffuse — usually whiter.)
Then, as you have thought, we usually consider this only in 3 different wavelengths/bands since that is sufficient to reproduce most, but not all effects that human vision can observe. For an example of phenomena that require more than 3 bands, see color rendering index, a measurement of how well the spectrum of a light source, after interacting with the reflectance spectrum of illuminated objects, simulates broad-spectrum illumination such as sunlight. You cannot simulate this without simulating more components of the spectrum than just RGB. For more examples, see this other question: Are there common materials that aren't represented well by RGB?
Lets imagine having a ray tracer setup with the sun as illumination, a few objects with different colors and a physical simulated camera with 3 color channels, where each color channel has a very small bandwidth of 10nm (see Figure2).
Computing using the RGB approximation does not generally think about wavelength bands at all — we just pick 3 precise wavelengths for our R, G, and B primaries and express all other colors in terms of mixes of those primaries, which are identical as seen by the (typical) human eye to more complex spectra.
Any such choice of primaries will constrain the gamut of colors that can be represented — some highly saturated colors will be excluded, unless the color components are allowed to go negative to express the most extreme monochromatic (or purple) colors. This is usually an acceptable limitation, because RGB monitors are physically limited to emit only specific wavelengths based on the color of their LED emitters, LCD color filters, or CRT phosphors.
(Note that in printed graphics, the situation is more complex because instead of a display device emitting only R+G+B light, we produce an object with its own reflectance spectrum based on the pigments/dyes used. That's why 4-component “CMYK” color is used — it's a better match for the actual behavior of the pigments. In some cases, “spot colors” may be used, identifying a specific pigment to be laid down in a certain area, to produce precise colors or special effects such as shininess.)
In case the ray is intersecting an object, can I scale the three values by the objects material reflection spectrum with respect to the 3 camera wavelength and bandwidth?
Yes, you should multiply each wavelength/color-component of the incoming light by the object's reflectance for that color. The bandwidth need not be explicitly modeled — if changing the bandwidth makes any difference, then it is equivalent to changing the choice of primaries, i.e. working in a different color space. You can always convert a color from one RGB color space to another (when it is in the gamut of both) with a little bit of arithmetic.
Again, all of what I've said above is true when you are working in RGB. This does have limitations; if you want to precisely simulate the effects of monochromatic lights or color filters, you will need to use more color channels than just RGB. The more channels you use, the better your discrete approximation of the continuous spectra in real physics. However, this is rarely done in rendering — most computer graphics you have ever seen in your life were probably only calculated using RGB.