Why is random sampling good? First, is there any theory for random sampling being optimal?
Second, consider the following example. Suppose there are two balls in an urn. Their colors can be either white or red. So there are three states: two red, one red on white, and two white.
In random sampling, one randomly draws a ball, puts it back, and draws once again. In this case, she cannot perfectly learn the states.
In a non-random sampling, one randomly draws a ball and draws the remaining ball. In this case, she can perfectly learn the states.
So it looks non-random sampling is better.
Edit: Maybe I confused "random" and "independent". In sampling without replacement, the result of the first draw is (conditionally) correlated with the second draw. In this sense, my question may be rephrased as whether and why (conditionally) independent sampling is good.
 A: The Central Limit Theorem may be the theory you're looking for.  It shows that random sample means follow a Normal distribution (even if the population isn't Normally distributed) and that allows us to use a lot of popular statistics like standard deviations, p-values, etc.
Of course, if your entire population of interest is two individuals, then you take a census, not a sample.  Sampling is used when the population (of individuals, events, etc) is too large for you to collect data on every individual case, or when it's otherwise impossible to do so (e.g., some cases are future events).
A: A non-random sample may be good for a particular purpose, or it may be bad. A random sample can be shown with high probability to be "good" for many purposes.
In particular, in statistics, our purpose is to learn general properties of a population. There are some non-random samples we can draw that help us do that very well, but also some that mislead us. Without prior knowledge about what kind of sample is useful, it's easy to mess up.
On the other hand, when we draw a random sample, we can prove that with high probability, we will get a sample that is "good" for our purposes. Sure, there might be deterministic ways to get a good sample too, but those may require a lot of knowledge and planning. Random sampling is much easier.
In your examples, the sample sizes are too small for us to prove the good things I mentioned above. But if the urn has 100 or 1000 balls, random sampling will give good results.
A: You seem to be conflating the idea of random sampling with the separate question of whether objects are sampled with or without replacement.  The first method you describe is a simple-random-sample with replacement and the second is a simple-random-sample without replacement.  In the second case the sample is the whole population so you do indeed perfectly learn the states --- that occurs whenever you take a simple-random-sample without replacement that has the same size as the population.
As to your initial question, there is a large statistical literature on the properties of random sampling and why it is desirable for making inferences from a sample to a larger population.  Simple random sampling does not favour any object in the population over any other object, which makes it easy to make unbiased inferences about the larger population of interest.  Whether or not a sampling method is "optimal" would require more detailed specification of the problem and the optimality criteria.  In any case, it is reasonable to say that simple random sampling performs well in a wide range of sampling problems.
