Backing up a bit, the way your chance to hit is calculated is you have "dispersion" in "Minutes of Arc" (a standard for firearm accuracy) from various sources. The gun itself, the ammo used, your skills, your dexterity and your aim level all contribute dispersion. When you fire, the game picks a random number between 0 and each dispersion value and adds them together, the result is how far off your shot is from hitting your aim point.
Example (not actual values):
Dispersion from:
dex 10
gun 20
ammo 10
gun(skill) 10
rifle(skill) 10
Aim 10
The game chooses a random number between 0 and the maximum for each attribute, so for example, 2, 15, 5, 6, 7, 8 and sums them (42), you always have a chance of getting a 0 with each attribute and getting a perfect hit, but the higher the various dispersion values are, the less likely that is.
If the sum of the max dispersion values are low enough that it would count as a hit, you will always hit. That is roughly how the "confidence" meter in the aim menu works, it evaluates roughly the worst case for the current shot, and gives you your chance to make varying degrees of hits (hit, good hit, critical, headshot). The "steadiness" bar gives your aim level, when it reaches the far right, you're aiming as well as you're able.
When you're aiming at a target, you start out with a default aim level that is much less accurate than the gun is capable of. You spend time (with '.', 'a', 'c' or 'p') to increase your aim level. Dex, gun skill, and the guns aim speed (low aim speed is faster) all contribute (roughly equally) to how fast you increase your aim level. The guns sight dispersion is the minimum dispersion you can achieve with aim level.
Multiple sights are treated somewhat unusually. Every gun has a default sight, whether that's no sight at all (aim dispersion 150, aim speed 0, you're effectively just pointing the gun at the target) or regular iron sights, or a rifle scope. You can attach more sights with mods, and each aim action will choose the fastest sight to use that will improve the aim level. So if you have a rifle that came with iron sights and has a rifle scope attached, you'll aim with the faster iron sights until they reach their cap, then switch to the rifle scope to zero in to the maximum.
As for the values, I pretty much winged it, if you have concrete suggestions for what the values should be, or even an ordering of the sight types by accuracy possible with them, I'm all ears.