If more people pile in to mining then the difficulty increases and total $$$ spent on electricity will increase. Conversely if mining hashrate declines then difficulty is decreased to compensate.
I'm not sure how the difficulty adjustment would cope with a severe and abrupt change in mining hashrate (take it to the extreme and imagine the hashrate drops to 1/1000th of what it is now, there are going to be a lot of unconfirmed transactions out there).