This Viking 1 Lander panoramic photo was taken because Carl Sagan was curious to see what the Martian landscape looked like at dusk. It was taken on Sols 163 and 164 (January 4 and 5, 1977) around 17:30 local solar time.
The original image was acquired in panchromatic mode -- that is, in black-and-white. It was processed and then colorized using the real colors retrieved from other images taken at sunset.
Olivier de Goursac shares this image as a tribute to Carl Sagan and to the Planetary Society.