Because the total quantity/scarcity of the "resource" is publicly verifiable, therefore each transaction reflects upon the value of the resource. After that, it just takes a somewhat arbitrary psychological leap to decide that you are happy to give things to others in exchange for the scarce resource. As long as there are a few people accepting the resource in exchange for things other than the resource, it takes on real world value due to it's representative relationship with other things. In the case of bitcoin, the main other thing is drugs. Drugs keep bitcoin valuable.