A home inspection is how you verify that the house is in the same condition before the closing as it was when you first agreed to buy the house. If any work needed to be done the home inspection is your opportunity to verify if it was done.
Not every buyer knows how to do a home inspection (this differs from an engineer's inspection and a termite inspection, both of which are done prior to signing the contract). When it is time for a home inspection it is generally a good idea to have the realtor with you in case you find anything.
During the home inspection make sure you run all the sinks, flush all the toilets, make sure all the windows open and close and all the doors open, close and lock. Test all the appliances, turn on the heat, etc.
Remember, the home inspection is the last time you will have the ability to tell the seller if there are any issues at the house that need to be fixed. Do not be ashamed to open refrigerators, turn on dishwashers and washing machines, etc. Take note of anything and everything that you find is no longer operational.
Keep in mind that not everything you find at the home inspection will be fixed - only those things that are not working that were working at the time of contract. Normal wear and tear on the house will also not be taken into consideration at the home inspection. However, broken windows, holes in the wall (not from hanging a painting), etc., can and should be addressed at the home inspection.