Solar power works only when the sun shines, right? Not necessarily.
Electricity generated during daylight can be stored in batteries, but from a cost standpoint this is practical only for limited applications, mainly those involving mobile devices, from cell phones to electric cars, that carry batteries anyway.
We could of course use sunlight as our main power source on bright, sunny days and switch over to a different energy source at night and in bad weather. Unfortunately, start-up and shut-down times are too long for some energy sources (such as nuclear) to make this workable, though natural gas power plants can be designed to start and stop as needed. But it's costly to build a solar plant and then another type of power plant as well, then use the second plant only about half the time.
But some solar plants operate by concentrating the sun's rays to boil water, as in a coal, nuclear, or natural gas power plant. Having an alternative source of heat energy is much less expensive than building a second entire plant.
An all-solar approach is under development at MIT and elsewhere. Their design uses highly concentrated sunlight to melt salt and create a molten underground heat reservoir that can continue to supply power long after suset, even conceivably days later.
Estimates of the final cost of such as system are uncertain, but on the low end it coule be very competitive. For more see this article.