Generators require maintenance just like any other equipment. Most large home standby generators will automatically start each week and power up diagnostics to make sure all is functioning properly.
Smaller generators require manual intervention. Replacing the oil and spark plug at regular recommended manufacturer intervals ensures a proper functioning generator.
If the generator is not going to be run for long periods of time then a stabilizer should be added to the fuel. The fuel could also be drained but you should consult with your operating manual and follow your manufacturers guidelines.
Another option is to buy a service plan from your dealer. Regardless of what option you choose, generator maintenance should be followed.