The other answers are correct, but one crucial thing is not mentioned.
Rotating mass, inertia, and grid frequency
If you increase or decrease the amount of active1 power you feed into the grid then this must be compensated for somehow. As others have stated, electricity must be used instantaneously.
pdb5627 correctly states that there must be equilibrium.
You can for instance charge batteries and/or reduce the power produced by power plants that can be regulated, as described by VoltageSpike and PStechPaul.
These are ways to actively attempt to create an equilibrium, and it's how grid operators maintain a stable frequency.
But, the grid frequency varies, and that's because the sum of production and the sum of loads (as we think of them) aren't equal at all times.
When someone turns off a motor, or there's a gust of wind, you'll have excess energy that must be compensated for. What happens in real-time is that the grid frequency goes up or down. The solutions VoltageSpike and PStechPaul mentions are ways to avoid that the frequency continues to rise, or continues to fall above or below certain given limits.
The figure below shows the grid frequency in the Norwegian/European grid a few minutes ago. As you can see, it goes up and down constantly.
The x-axis is 90 seconds and the y-axis goes from 50.000 Hz to 50.010 Hz.
In the 4 minutes from 12:09:30 to 12:13:30, the grid frequency went from 50.0011 to 50.0384
Obviously, 0.0373 Hz is not much, unless you remember that this is the frequency of every single synchronous motor and generator in the entire grid2. The amount of inertia and rotating mass that's present in the grid is enormous, so a small change in frequency means a lot of excess energy has been stored (or used) in the rotating masses in the grid.
Go check it out yourself. :) (At this very moment the frequency is 49.973 Hz.)
1 If you haven't heard of active and reactive power then you can disregard the word active.
2 We usually consider the grid frequency to be identical in the entire interconnected grid. This is not really true since there's a delay and damping factor. A large motor being turned off in Sweden will cause a frequency spike and a temporary frequency rise nearby (until the load loss has been compensated for). The frequency in nearby stations will also increase, but the effect in Spain is obviously negligible. The effect from one single motor will only have a limited reach, but a cloud momentarily covering a 1 GW solar plant will have a greater reach.