This is based on the method used to convert repeating decimals into fractions:

You can also think of it this way:
0.1111... = 1/9
0.2222... = 2/9
      etc.
0.8888... = 8/9
0.9999... = 9/9 = 1