Why do Bitcoins have value?
Like any other asset that has a market price, it's all a matter of supply and demand.
The supply side is relatively trivial, the protocol allows for a fixed amount (25 bitcoins at the time of writing) to be produced every tenth minute, this reward is cut in half at regular intervals, and with this algorithm there will never be more than 21 million coins. However, scarcity by itself is not sufficient, there needs to be a demand as well. There are many factors behind the demand, I believe none of them are sufficient alone, but some may be more important than others.
A working currency needs to be scarce, divisible, portable, durable, fungible and easy to verify. Bitcoin scores pretty well on those attributes and was the first digital currency to do so. However, it's not alone a guarantee to success. Other cryptocurrencies (aka "alt-coins") may be competitive on all the above.
The belief that Bitcoin will be a viable means of paying for goods and services in the future. This may cause a sustainable and predictable value. As an example, assume that 21 million people are buying bread with bitcoins, and in average they'd like to hold enough bitcoins in their wallets to buy 10 breads. For a brief moment, let's assume this is the only use-case scenario. With 21 million bitcoins in circulation, that means every user by average has one bitcoin in the wallet. The value of a bitcoin would then be ... exactly ten breads!
A belief that Bitcoin is "digital gold", a useful means of storing value. Someone even says ... "payments aren't important, bitcoin is the digital gold, and gold is rarely used for payments" - I believe that's dangerous. Gold has been established both as a currency and as a "holder for value" for millennias, while Bitcoin hasn't even been around for a decade. Traditionally almost every currency was both backed by gold and pegged to gold, so all until the 1970s one would indirectly use gold for paying for goods and services. Gold also has unique characteristics suiting this purpose, gold cannot easily be replaced by other metals while Bitcoins can easily be replaced - i.e. if another altcoin gets more popular than Bitcoin for payments, I predict the BTC-value will drop pretty fast.
Speculation - people hoard bitcoins because they expect the market price to increase further in the future. As of today, this is probably the biggest driver of demand, and it's by itself enough to spur a price growth, but it may not be sustainable. Critics compare Bitcoin to a ponzi scam, a pyramide scheme and tulip mania. Even though none of those comparitions quite hit the mark, if the value is only driven by speculation there is a risk that at some point there may be a crack and the value may fall very fast (like it did when MtGox failed).
Trust in the scarcity. The risk that the 21M hard limit will be increased through a protocol change is considered small. However, Bitcoin doesn't have a monopoly on cryptocurrency as such, it's easy to create new altcoins, and there are already hundreds of altcoins which could theoretically replace Bitcoin.
Trust in the security of the transactional system. The blockchain and proof-of-work delivered by the miners ensures that a transaction remains irreversable and that bitcoins cannot be double-spent. The cryptographical algorithms used for signing transactions ensures that nobody but the owner of the bitcoin can spend the bitcoin. It has been argued that the market cap of any cryptocoin have an upper bound in the security of the system; the market cap can never become so big that it would be profitable to buy the processing power needed to successfully double spend or brute-force-engineer private keys corresponding to existing valuable public keys. Reversely, the same argument can be used to prove that Bitcoin is a secure network (at least when neglecting the risk of phishing, robbery, social-engineering, gaining access to wallets through security holes, exploits or lax password security, missing backup, etc). The fact that the ledger is secured by an extreme amount of processing work may be one of the points where Bitcoins really excel compared to competitors.
The network effect - this is the (only) thing where Bitcoin excels on the altcoins. (Almost) everyone that accepts cryptocurrency accepts Bitcoins - but only some few accepts other cryptocurrencies. Never underestimate the network effect. Bitcoins may become worthless very fast if some other cryptocurrency takes it's place.
Usefulness for criminal purposes; Bitcoin is perceived to be anonymous, it can be very anonymous if one wants it to be, it crosses borders easily and without regulatory oversight, hence it's the ideal currency for ransom, tax evasion, drug smuggling, crime-as-a-service, etc. I sure do hope that this is a smaller driver for value than the usefulness for legitimate payments for goods and services.