iv often wondered this. when i was a kid i thought it was done alphabetically but that went out the window when i realised that something like Arsenal were number 12 and West Ham were number 8
1-something are alphabetical order of the teams that qualify automatically for that round. The rest are in the order that the previous round's ties were drawn.