How is the exchange rate for Bitcoin established?

The simple answer is that it is the price at which a seller and a buyer of the currency agreed on a price for it; i.e. the price at which the market clears. The sold currency is, after all, a commodity.

It may help you to strip away any superfluous notions to think of it as a pound of coffee or somesuch. Seller Sally has coffee but wants dollars. Buyer Bob has dollars and wants coffee. Sally will not part with her coffee for less than $4. And Bob will not buy coffee for more than $3 dollars. The market fails to clear at these prices. A new seller, Sam enters the market and is willing to sell his coffee for $3.50. And a new buyer, Bill, enters and is willing to buy coffee for $3.50. Sam and Bill exchange coffee for dollars. This fact is published to the rest of the market participants; who are thereby able to conclude that at some point in the recent past that two participants were able to transact at the price of $3.50. As an entrant to the market, are you guaranteed to find another buyer or seller at that price? No. But it’s a useful piece of data.

If you really want to know how this — and economy in general — works, you’ll have to do a little reading. As a start, I recommend:

Murray Rothbard, Man, Economy, and State

Ludwig von Mises, The Theory of Money and Credit