I am trying to understand why there is variations in resistance values, in other words, why there is difference in the value of the resistance between color code and the measured resistance. Also, how to manufacture more precise resistors?
Modern carbon-film resistors are actually manufactured to a nominal 0Ω, then laser-trimmed to the desired value. A laser burns off bits of carbon to increase the resistance, then the resistor is encapsulated, printed, and packaged on tape.
However, the laser doesn't burn off a consistent amount of carbon. The manufacturer increases precision by testing the resistor and burning off more carbon to approach the target value. The more tests and adjustments are made, the higher the precision.
Of course, repeatedly adjusting the resistor consumes time, which makes precision resistors more expensive to produce.
To maintain precision, the resistor is also tested after being encapsulated and fitted with pads, in case a manufacturing defect pushed the value out of spec.
Andy aka is quite right above, statistically if you manufacture hundreds of resistors there will be some statitical variation in the output. Thats said, resistor precision depends on several such as resistor techonology (wire-wound, chip, etc), temperature of operation (the resistance of a straight piece of wire will vary with temperature) and frequency of operation.