Many things work together to bring accuracy in the firing of a gun. Some of these relate to the firearm parts themselves, while others have to do with the ammunition that is used. It does bear acknowledging that the shooter too plays a heavy role in firing accuracy; his or her sighting, trigger pull, etc are significant factors. That said, a few design and mechanical elements too can influence whether or not the bullet hits the point it was intended to. The following are the basic ones every gun owner needs to be aware of.
The Gun Barrel
The barrel plays a big role in accuracy, impacting aim in many respects. The most obvious one is the fact that the bullet gets spun by the rifling inside the barrel. Being the component of the gun that contacts the bullet when it is moving, the barrel is also responsible for guiding its path. It vibrates when a shot is fired, causing minute plastic deformations that add up to something sufficient to affect accuracy. Most barrels come with pre-set service life, although it is common enough for one to become unreliable before that period is up, usually due to poor construction. Barrel metal stiffness is another factor correlating with vibration, which if it exceeds a safe limit, can diminish the consistency of bullet trajectory. In other words, you get a higher chance of a stray shot.
This is the inside of the barrel, which is basically the part down which a fired bullet travels. The twist rate of the bore is supposed to rise slightly towards the barrel’s outer end. Twist rate is the number of barrel inches coinciding with a full revolution of the bore’s spiral grooves. That means with a 6:1 twist rate, you need 6 inches of the barrel for one complete groove revolution.
The bullet is important because specific twist rates are suitable only for specific grain weights. Bullet flight generally stays stable the slower the twist rate you have (longer distance between consecutive twists, say, 20 inches), but this could be overturned by the caliber – each caliber claims an optimal twist rate. For instance, a Glock 19 possesses a twist length of about 9.8 inches, because 9mm rounds normally achieve good accuracy when used with 9-11 inch twist rate. Similarly, a Colt Series 70 possesses twist length of around 16 inches when using.45 ACP.