20mm guns were undirected...the gunner just pointed and shot at anything that came into his range. Late in the war they started mounting a lead computing gunsight on them...
40mm guns were directed. Look at good photo's and you will see that for every 40mm tub there was usually a corresponding director tub. I believe of the top of my head they were Mk 41 directors. It was a simple optical device (same lead computing basic sight eventually fitted on the 20's) with handlebars and switches and connected to a computer (WWII type mechanical...).
The director would follow a plane, keeping it in a reticle, when he had it "caged" he would squeeze the handle on the grip. As long as it stayed "caged" the computer would calculate deflection angle, lead, etc, and feed it to the gun captain of the 40 it was connected to. Of course they could be aimed un directed too...
5" typically used the big directors, I forget the nomenclature off the top of my head. They were originally optical, but by mid war were radar directed...early on the distinctive "W" on its side shaped antenna, later a circular antenna. Look at good pics, especially on DD's...you can't miss them. Same deal, crew inside the director would choose a target, track it, data was computed and fed to the 5" turrets.
As far as fuzing, yes, we were the only ones to have the VT type fuze. It was a fuze that used magnetic fields to determine detonation. The fuze had a series of thin copper plates along with an ampule of nasty acid. When fired the ampule would break, and acid would flow along the plates, and it would create an electrical field I guess. When it neared a large metal object the change in fields would set off detonation. So when the shell passed within range of an aircraft...BOOM.
It was one of the things credited with winning the war. For example, Germans only had time fuzes for their main AA guns. While they had the best technology for timed fuzes...they still were nowhere near as good as VT's. It is thought that if the Germans had good VT fuzes, they could have made the bombing campaign costly enough to cause its cessation. Luckily they never developed a good mass production VT fuze....