Just remember the basics, that there are 3 settings that will define the final exposure of your image. Those are your shutter speed, ISO and aperture.
If you're talking about a photo taken at ISO100, 1/100 and f/8 (for example) and you change any of those then you're going to end up with a different amount of light getting to the sensor, and therefore either a lighter or darker image. If you up the ISO to 200 then you've got the sensor being twice as sensitive, so the exposure will be +1EV rather than 0 and it will look considerably brighter. Conversely, if you halve the ISO to 50 then you'll end up with a darker image.
Likewise with the shutter speed. Changing that to 1/50 with hold the shutter open twice as long which means the sensor will see twice as much light as before and the exposure will be +1EV. And also if you make it 1/200 then you'll only get half the light in and the exposure will look darker, and be -1EV.
Aperture is the same. With the aperture opened up 1 stop to let more light in (to f/5.6) then you're going to get a +1EV exposure in the same way as you would have by bumping the ISO up, or by holding the shutter open longer. The same applies for closing the aperture down by 1 stop to f/11, you'll get a -1EV exposure and the image will seem darker.
So you have ISO, shutter speed and aperture. If you take your standard ISO100, 1/100, f/8 image and mess with your settings and end up taking an image at ISO200, 1/200, f/8 then you're going to get the same exposure (with respects to light/dark) as you would with the original settings. Half the shutter speed but double the ISO means you'll get the same exposure.
In Tv mode, you set the shutter speed you want. This is the key thing you want to set with panning. If you can track the cars at 1/50th (which by the look of your pic, you can) then you set that and the ISO that you want (the lower the ISO, the less noise) and the camera chooses which aperture would give you the correct exposure.
In your supplied pic you have pushed the ISO up to 800 and the camera has decided that it is getting waaaaay too much light with the sensor up that high so it has had to close the aperture right down to f/22 to get the exposure reasonable. If you had dropped the ISO down to 400, then the camera would have chosen f/16 instead. If you had gone down to ISO200 then it would have gone with f/11, and if you were right back down at ISO100 then it would have gone with f/8.
I think the reason you may have had dark images is that you reached the limit of what the lens could actually do at some stage. If you try to get an exposure by setting ISO and shutter speed in a situation where the camera calculates that it would need f/2.8, but your lens is only capable of going to f/5.6 then it will expose as much as it can with the settings you have applied (ISO and shutter speed) but the lens can't open enough to get light in for a correct exposure. This is something you'll need to be aware of if you're letting the camera chose things for you (ie, not using manual mode).
If you're going for an aperture much smaller than f/11ish then you start losing sharpness. A problem known as diffraction. f/8 is usually the sweet spot on most lenses. f/22 will definitely be robbing you of some sharpness.
The other thing, if you're taking photos and finding that the setting you have applied all seem correct and you're still getting images that are under exposured then you can up the EV. This is the -3..-2..-1..0..+1..+2..+3 bit on the back of the camera. Turn that up to +1 and it will expose a bit more light.