Why doesn't runif generate the same result every time? Why is it that random number generators like runif() in R don't generate the same result every time?  
For example:  
X <- runif(100)
X

is generating different outputs every time. 
What is the reason for generating different outputs every time? 
What functionalities does it have going on in the background to do this?
 A: At heart this is not really just an R question; it relates to random number generation more generally.
"Random" numbers are very important in many parts of statistics. We need the random values we generate to have certain properties, and (usually) a lot of effort goes into constructing random number generators and checking their properties.
The idea is we want to get a sequence of values that are a good proxy for actually random numbers. The usual workhorse of random number generation is the uniform distribution (from that we construct others, like Gaussian random numbers).
So (most typically) a numerical algorithm is used to construct a sequence of integers, each one in terms of some function of previous ones. These integers are then scaled to lie between 0 and 1 (usually $[0,1)$ ).
For example, many just work on the previous one:
$$x_1=f(x_0)\hspace{1cm}z_1=x_1/m\\
   x_2=f(x_1)\hspace{1cm}z_2=x_2/m\\
   x_3=f(x_2)\hspace{1cm}z_3=x_3/m\\
   \vdots$$
... where the $x$'s are integers, the $z$'s are then scaled to be in the unit interval, and $f$ is some often complicated but usually fast function that operates on the bits in its argument to produce a new set of bits that (hopefully) don't seem to be related to any previous values (if we look at them in all manner of ways, even quite carefully -- even though they really are related, since that's how they're made). These have to be constructed carefully to make sure the sequence has a very long cycle and that its values are really uniform and aren't sequentially dependent in any way we might really care about (along with a host of other requirements that are usually regarded as important).
They require a starting ("seed") integer ($x_0$), which you supply (some algorithms may need more than one seed). If you use the same seed again, you get the same sequence (which is handy for being able to reproduce results). But some of the time, you just want some random numbers, and you don't care what the seed is as long as the start point is different from the previous lot you used.
So if you don't supply a seed, many packages can just make one for you. Some packages look at the last few digits on the internal digital clock (usually manipulated in some way). Some (R included) store the last value (the integer $x_3$ above, more generally the term "the state" is used to cover cases where there's more than one number involved) that was generated by the random number generator to use as the next seed if you don't supply one.
See ?runif in R and you'll note that it explains about the existence of the random seed, with a link to the help on that ?.Random.seed which explains the large number of random number generators available in R (you can even supply your own). The same help page explains that if you haven't used random number generation before or set the seed, to begin with the seed is taken from the clock, and thereafter the previous value is stored (so that the next random number you get would be the same one you'd have obtained if you'd generated one more value last time -- it remembers "where you're up to").
The function runif in R (like quite a few other random number generation routines in other packages which can usually do something similar) knows about the place where the random number seed is kept. It keeps updating that value as it goes. So it can operate without having to explicitly be passed a seed, but it still uses one; if you didn't give it one, it just uses the one it saved last.
As for why it gives different outputs each time (if you don't tell it to give the same sequence): it does this because the same values every time would usually be very counter productive -- it wouldn't have the properties that repeated random sampling would have, making it not very useful for the putposes we use random number generators for. 
A: You have to set the random seed in order to get the same result each time.  Use ?set.seed to do so.  Consider:  
> runif(1)
[1] 0.6467259
> runif(1)
[1] 0.2101857
> set.seed(1)
> runif(1)
[1] 0.2655087
> set.seed(1)
> runif(1)
[1] 0.2655087

You may be interested in reading this:  Reasons for using the set.seed function.
