Some energy sources will be low directing certain times of the day, and others will be high, causing it to mostly average out.
And for the stuff that doesn't average out, there is peaker plants.
Things could be further made better using varying electric pricing, such that when energy is plentiful it is cheap, and when it is scarce it is expensive.