There are a few useful ways to define randomness. To make things simpler, consider a sequence of bits: either 0 or 1. Functionally, this is the same as a series of coin flips: either heads or tails.
A sequence of bits could be said to be random if:
Note that the output of a PRNG can not meet the second condition if Algorithmic Information Theory is taken into account. See Introduction to Pseudo-Random Number Generators (PRNGs) for more information.
All statistical tests of randomness are designed with these two definitions of randomness in mind. The design of such tests is, I've discovered, an interesting subject in its own right. Some tests are almost traditional; others are clever ideas that have occurred to individuals.
For some examples of tests, see my test suite in
The Tests in KonStat2.c
section of
the Konton2 page, Prof. George
Marsaglia's famous DIEHARD suite of tests,
"Some difficult-to-pass tests of randomness" by Marsaglia and Tsang, and
the NIST's test suite.