It is necessary to either turn off machines before going to bed, or set them to turn off automatically. If you don't, they'll continue running long into the night, until either their fuel runs out or they break, no matter how much fuel they have. The power grid, after gradually ramping down to meet decreasing demand over the course of each evening, shuts off entirely at 30:00 each night. Any applications which need to run longer than this, such as security cameras, must have their own energy storage.
One might wonder then how it is that each morning, food is not all completely rotten, iron isn't completely rusted, and the air, deprived of sunlight for an infinite length of time, is not frozen solid. The answer is that naturally, all these things go to sleep too. Refrigeration may be one way to preserve food, but an even more effective way is to store it somewhere so terribly comfy that it falls asleep before the day is done. Even the celestial bodies fall asleep each night, so the planets proceed only a finite distance along their orbits, and the stars don't run out of hydrogen.
In order to somewhat maintain security without requiring that guards remain awake longer than any possible burglar, doors may be constructed to be very heavy sleepers, difficult to rouse and move once they have fallen asleep.
For certain rare and expensive high-performance computing applications, a nuclear reactor may be used to power a data centre for tens of thousands of hours per night. However, the reactor must follow a particular sort of design to account for the fact that the radionuclides themselves eventually fall asleep. Spontaneous fission of the fuel ceases to occur, and only induced fission is possible, so the reactor must be kept perfectly on the edge of criticality to maintain the neutron flux, all while completely unsupervised because all the technicians are asleep. The following morning, the spent fuel then requires even more careful handling because all of the accumulated daughter nuclides wake up at once, giving an enormous pulse of heat.