How to create Windows Service?

We can create windows service for running something in the background with the control given to the user like when the service should start or end and many other thing .