As buyers, you are responsible for inspecting the home on which you have an accepted offer. Normally, a buyer is given about a week after their offer is accepted, as per the contract, to do due diligence and make sure the property you are looking into is as the seller is representing it.
Inspection is one of the most, if not THE most, important item on the todo list for that week. A professional inspector walks through the whole house or apartment, checks the plumbing, flooring, appliances, lights and electrical panel, windows, boilers, mechanical and electrical rooms, etc...
The inspection normally takes about two hours (regardless of the size of the home) and at the end, the inspector provides you (the potential buyer) with an extensive report. The report contains any problematic areas in the property with recommendations about how to remediate them.
The cost normally starts at about $300 plus applicable taxes. Beware that a less expensive inspection quote may not necessarily be a good thing. You want a very thorough inspection done on your most important investment to prevent potential big ticket problems in the future.