What exactly is an appraisal and how does it factor into a purchase price? I mean, if a house appraises for $300K and that is the true market value of a house, why would a logical person pay more? Does an appraisal exclude certain factors like curb appeal or market demand?
The basic answer to this is that real estate appraisal is not an exact science. In some sense it cannot be, because every piece of real estate is unique, so there are no exactly comparable "goods" whose price can be used as a benchmark. Various methods are used to approximate the value. You may want to read the Wikipedia article on real estate appraisal.
More specifically, the appraisal is an estimate of the value that the property could or should fetch on the open market. The relationship between the appraisal value and the actual sale value is up to the buyer and the seller. You can offer to sell your home for any price you like, and someone can offer to buy it for any price they like. The appraisal is an estimate of a reasonable price that buyer and seller might agree on.
However, individuals differ in the relative value they place on certain features, so different people might be willing to offer different prices for the same piece of real estate. For instance, suppose a house is appraised for $100,000. Suppose it has a swimming pool and is next to a school. Someone who has kids that go to that school might be willing to pay more than the appraised value, because their specific circumstances cause them to attach extra value to the location adjacent to the school. On the other hand, someone who doesn't like to swim might be unwilling to pay the full appraised value, because they don't consider the swimming pool a major plus. So you may be able to sell the property for more than the appraised value, if you can find the right buyer.
So the appraisal does in some sense include factors like curb appeal and market demand (e.g., if a house looks nice, that will generally raise its appraised value). The problem is not that appraisals don't take those factors into account; the problem is that there is no single definable value for many such factors. Trying to compare the "curb appeal" of two houses may be like trying to decide whether the Taj Mahal or the Eiffel Tower is a more aesthetically pleasing building; it is more a matter of opinion than of fact. This is also one reason that appraisers usually focus on one area: it is easier to get a feel for slippery notions like "market demand" if you are familiar with the local real estate market, and someone without experience in the local area may not be aware of various nuances that could affect a property's value.
In short, there is no single "true" market value; there is a different true market value for each possible buyer. It might be perfectly logical for one buyer to pay more than another for the same house, if that house's attributes are actually more valuable to that buyer. This problem does not arise with most other common kinds of assets because they are fungible (e.g., any share of General Electric is the same as any other). However, a similar situation does occur with valuing one-of-a-kind assets such as paintings.
Is there an independent company I can go to, to get an analytically based valuation for a house? Preferably someone who charges a fixed rate so that they have no incentive to lowball or highball their valuation. How would I go about finding this?
That is what a real estate appraiser is. At least in the US, you can typically seek out appraisers in the local area around the property in question. There will be independent appraisers who offer their services to various sorts of clients. My understanding is that the fee is usually flat, not based on the ultimate appraised value, although it may be based on the size and value of the property in the general sense that that affects the difficulty of the valuation. (That is, you may be charged more for an appraisal of a large mansion because it takes more time to inspect and to find comparable sales to use as a reference point.) In any case, you can ask the appraiser for a price quote beforehand.
The appraisal will be "analytically based" in that there are standard methods for arriving at a value estimate. (Some such methods are described in the Wikipedia article.) However, for the reasons described above, just because it is "analytically based" doens't mean its infallible or will be accurate for any particular buyer. Appraising a piece of real estate is not an open-and-shut operation like putting a tape measure up to the building and measuring how tall it is.