How does the phone company issue a phone number?

The number is generated by a computer - according to the rules for the length of number and type. For example, a mobile (cell) phone number in the UK needs to start with the digits 08 - the computer will generate the next nine digits at random, but will reject any number that's already in use. Once it's generated a suitable number, it creates a data file with the customer's contact and bank details.