The C rand function generates random numbers using a seed (just like most -- any? -- pseudo-random generator).
srand is used to set the seed to be used by the random generator algorithm. The value returned by time (ie: the current second) is usually passed to such function because it's the most simple-to-get value that is usually different between two executions of an application
There's an article at Wikipedia that gives some good history and examples of algorithms used.
The short version is that rand() and its ilk are pseudorandom number generators. In fact, they're actually deterministic—the sequence of numbers produced is always the same. However, the sequence is very very long, and the seeding mechanism provides a means of starting at a (more or less) arbitrary place in that sequence.
Depending on how the random numbers will be used, there are a variety of criteria for evaluating the quality of a pseudorandom generator. In very simple circumstances, perhaps all that's needed is a low probability of repeated values from consecutive calls to rand(). However, you're likely to want the numbers to conform to a particular statistical distribution as well. (As far as I know, most PRNGs produce uniformly distributed numbers. However various functions exist or can be easily written to transform this into a gaussian distribution or any other you might need.)
Finally, when security is a concern, you want an algorithm that is, for all practical purposes, unpredictable. If an attacker knows the previously generated number, she shouldn't be able to then anticipate the next. In very high security applications, a truly random number generator might be used; these would rely on various external sources of randomness, such as radio static, the thermal noise in an image capture device (lens cap on), or other such sources. Also, many modern operating systems (including Linux) gather and store an "entropy pool" from various sources such as unpredictable user interactions and allow the production of random numbers from that.
A common programming error from people not used to working with pseudorandom generators is to re-seed before every call to rand(). Of course, this is unnecessary a