Let's answer this question in two parts. Firstly...
What is RNG?
Computers need some way to make decisions -- for example, choosing what Pokemon you will encounter when you run in tall grass, or what that Pokemon's stats will be. To make that choice, computers can use random numbers. For example, if there are 25 natures, then the computer might pick a random number between 1 and 25 to choose what nature your wild encounter will have.
A random number generator (RNG) is what we use to create random numbers. In practice, a RNG is usually some algorithm written in computer code that transforms an input number to an output number, where the output number should have little/no relation to the input number (i.e. the output is random). There are many kinds of RNGs that each differ in performance, complexity, security, and of course: statistical randomness.
We say "statistical randomness" because computers cannot truly be random -- only pass tests of empirical randomness. For this reason, most consider the term pseudo-random number generator (PRNG) to be correct. The "best" PRNGs are functionally impossible to predict and are safe to use in cryptography, etc.
What is RNG manipulation?
Though Pokemon has modernised its approach to RNG in recent times, it has historically used simple PRNGs that are very easy to predict. This gives rise to RNG manipulation, where we massage the game into giving us favourable outcomes (e.g. Shiny, 6 IV, the nature we want, etc) using our knowledge of the RNG it uses, and what it actually does with the generated numbers.
Using Gen 3 to 5 as a reference point, Pokemon makes heavy use of a type of PRNG called a linear congruential generator (LCG), which is very simple despite its name. It takes an input number (the seed), then does some addition and multiplication to get an output number, and then remembers that output number (the state) to use as the seed next time we want a random number.
How many times we advance the state is called the frame (or simply "advances"). For example, if we start with 24983 as the seed, then run the algorithm 10 times and end up with the number 75864, then 75864 is on the 10th frame for the seed 24983.
Since the state feeds directly back into the seed, this RNG unravels completely if you know the input number. What's the input number? Usually, it's just the date and time of your console when you boot the game!
We can abuse this easily. Say we know the number 75864 (from the example above) will cause us to get a shiny. All we need to do is set the date/time of our game to match 24983 (in computer terms), then cycle the state nine times to get our number. If we then trigger an encounter (thereby consuming the tenth frame), we'd get a shiny!
What to do from here
Thanks to extensive research, we know all about the game's RNG, when/how the game advances the state, and what it does with the numbers it creates. People have written programs (chiefly, PokeFinder) that let you pick the exact traits you want, then go search for a seed + frame that will give you those traits.
These programs, plus a bit of patience, can get you a 6 IV Ditto and let you complete breeding projects that are prohibitively difficult without.
Screenshot of PokeFinder: A filtered list of seeds + frames that can yield 6 IV Ditto encounters on Route 47 in HG/SS.
Below are some resources if you want to get started. Gens 3-5 are the closest application of the information in this answer about LCGs, while Gen 7 is generally considered the easiest to get results in. RNG manip is mostly dead as of Gen 9, as Pokemon has stopped using global state RNG (i.e. instead of tracking state, it dynamically re-seeds the RNG using hardware parameters, so we can't "unwind" it like the simple LCGs in old games).