Computers are deterministic1
In mathematics, computer science and physics, a deterministic system is a system in which no randomness is involved in the development of future states of the system. A deterministic model will thus always produce the same output from a given starting condition or initial state.
Deterministic Systems — Wikipedia
Think of a computer like a cook who has been handed a recipe (a program) to bake a cake. Computers do not deviate from the instructions (input) in a program, meaning that each cake they bake (output) will be identical.
So how do programs (including games) implement randomness?

Comic #221: Random Number — xkcd
A mathematical formula is used to "fake" randomness. This is known as a Pseudorandom Number Generator (PRNG), often abbreviated to just Random Number Generator (RNG).
The problem is, being a mathematical formula — if you give it the same input value, you'll get the same output value. So what a PRNG does is feed the values it generates back into the formula to get more values, and so on. But we're left with a problem:
What is the initial starting value?
This is where the "seed" gets its name. It's a seed value, a number used to start the random number generator, so that it may generate future pseudo-random numbers.
In most games, the seed is determined automatically using a few tricks, like deriving a value from the system clock, or the number of frames generated before user input. But this is also why clock manipulation or frame-counting are popular tactics in speedrunning circles — because they can take the "randomness" out of certain actions, to guarantee a more perfect run.
Other games like Minecraft, which relies heavily on randomness for it's world generation, allow you to manually specify a seed to get the "same" world generation.
Math/Comp-Sci crash course:
Just for fun, let's look at a working example of a basic pseudorandom number generator2:
Next_Value = (Multiplier * Current_Value + Increment) % Modulus
The Modulo % operator gives us the remainder after division by the Modulus. For example, if 10 / 8 = 1 r2, then 10 % 8 = 2. So let's set some values in the formula, and generate numbers between 0 and 100:
Next_Value = (7 * Current_Value + 5) % 101
We need to seed Current_Value with something, so let's use a seed of 1:
| Current Value | Formula | Next Value |
|---|---|---|
| 1 (Seed) | (7 * 1 + 5) % 101 | 12 |
| 12 | (7 * 12 + 5) % 101 | 89 |
| 89 | (7 * 89 + 5) % 101 | 22 |
| 22 | (7 * 22 + 5) % 101 | 58 |
and now, let's try a seed of 42:
| Current Value | Formula | Next Value |
|---|---|---|
| 42 (Seed) | (7 * 42 + 5) % 101 | 97 |
| 97 | (7 * 97 + 5) % 101 | 78 |
| 78 | (7 * 78 + 5) % 101 | 46 |
| 46 | (7 * 46 + 5) % 101 | 24 |
As you can see, we're getting some "fake" random numbers, based off a seed value! Pretty cool, right?
- This is true for most computing applications you'll encounter day-to-day. In specialised cases (such as high-security applications) computers can act as non-deterministic systems by utilizing True Random Number Generators (TRNGs). These devices measure unpredictable physical phenomena (such as thermal noise or radioactive decay) to generate data that is truly random and not based on a formula.
Non-deterministic behaviour may also be observed from situations such as multi-core processing (race conditions), hardware faults, or Single-Event Upsets (SEUs) (i.e. cosmic rays flipping bits, etc) - This type of PRNG is known as a Linear Congruential Generator (LCG). There are other (more robust) PRNG formulas, this one just serves as a good simple example. This LCG will loop after about 100 iterations, and visit almost every number in the range 0-100, except 16. This is a consequence of the specific parameters chosen for the example. 16 is a "fixed point" for this specific equation (if you use 16 as the seed, you get 16 back: (7*16+5 = 117 -> 117%101 = 16)