How can hashes be unique if they are limited in number? I'm curious, how can for example SHA-256 be unique if there are only a limited number of them?!

For clarification:
how many MD5 hashes are there?
$16^{32}$ MD5 hashes can be produced. 
$16^{64}$ SHA-256 hashes can be produced.
while there are $16^{128}$ just SHA-512 hashes, let alone long texts. 

For more clarification:
assume we want MD5 of all the SHA-256 hashes.
we can have $16^{32}$ number of MD5 hashes, while there are $16^{64}$ SHA-256 hashes.
we will have 3.4*$10^{38}$ duplicate MD5 hashes!  

And so is for SHA-256 hash, if we calculate SHA-256 of all the SHA-512 hashes, we will have 1.15*$10^{77}$ duplicate SHA-256 hashes!

Edit: This is not limited to a particular hash like SHA-256.
how can for example SHA-256 be unique if there is only a limited number of them?!


Where your issue occurs is that they're not unique.  It's just very improbable that they'll reoccur.      Unique in this context is not a mathematical definition, it's a humanist one.  

In terms of human numbers, $ 2^{256} $ = 115792089237316195423570985008687907853269984665640564039457584007913129639936 which is 0.1% of the number of atoms in the visible universe. So that's a lot of them.

There's a better  answer @ Why haven&#39;t any SHA-256 collisions been found yet?, but you should get the gist from the lengthy 116 quattuorvigintillion number.