As Chris said it is the land that generally goes up in value and it is the building which is depreciated and loses value as time goes by.
Picture this: You buy a newly built house for $300,000 where the land value is $100,000 and the newly built house is valued at $200,000. Lets assume the land value increases by an average of 5% p.a., so it would roughly double in value every 15 years.
Scenario 1: Over a period of 30 years you do not spend any money at all on the house nor carry out any maintenance. Your land value has increased to $400,000 after 30 years. Your building on the hand (without any maintenance over 30 year) would be dilapidated and run down. Its value may have reduced to about $40,000, as most people would only buy this house to either knock it down and re-build or to do major renovations to it.
Scenario 2: Over the same 30 years you do minimal maintenance and spend as little money as possible just to keep the house habitable. At the end of 30 years the house has an old and out-dated kitchen and bathrooms, old but clean flooring, and is generally old looking. The land value is once again $400,000 and the house maybe about $80,000. Some investors or first home buyers may be interested in buying this house as they can spruce it up a bit and then rent it out or live in it for the first home buyers. As the house is old looking they would pay less than other newer looking houses in the area.
Scenario 3: This time the owners spend a decent budget on the house to keep it in good condition over the 30 years. After 30 years the house is still sought after as it has been well maintained and may have a value of between $150,000 to $200,000. The land once again is valued at $400,000.
Scenario 4: Over the 30 years the owners have carried out some major renovations, they have added a second story, added extra bedrooms and a second bathroom. The land is again worth $400,000 and the house is now valued at over $300,000 as it is comparable with brand new houses in the area.
Now, unless you spend money maintaining a building, as with any man-made asset, the building will deteriorate and lose value over time. Depreciation takes this into account as an asset is usually depreciated over the asset's effective lifespan. If you make improvements to the building it can increase both the value and lifespan of the building. These improvement can usually also be depreciated.
A Property's Market Value
The market value of a property may not always represent the property's true value, as we are emotional beings. During boom times the market value may be much higher that the true value and during a bust the market value may be considerably lower than the true value. Just like with the stock market, where the market price of a stock can be higher or lower than the stock's true value, the same is true for the property market.
Many people pay way to much for houses during boom times due to them getting too emotionally involved with the house. They fall in love with the house and don't want to miss out buying it, so they pay way more than they initially wanted to pay for it.