Spain has lost four military aircraft to mid-air collisions this year (two Mirage F-1s in January, and two F-18s this month). Such accidents are getting more attention, because similar accidents in commercial aviation have sharply declined over the last few decades as collision alert devices were developed. Commercial aviation accident rates have declined 90 percent since World War II, mainly through the introduction of more safety devices and more reliable aircraft.
This has made pilot error the major cause of military and civil air accidents. With military aircraft, particularly fighters in training, that collide in the air, it is all about pilot error. But this is difficult to avoid, as the high speed maneuvering, in close proximity to other aircraft, is unavoidable, when you are training pilots for combat. While some of the most dangerous such training has been shifted to flight simulators, you still have to spend time practicing in the air to obtain useful combat skills.
But military pilots still make errors even when not practicing for combat. The recent loss of an Indian Su-30 was initially thought to be engine or electronic problems. But the investigation team found that the pilot had inadvertently shut down the automated flight controls, was not aware of it, and believed the aircraft was, for some unknown reason, out of control. The pilot and weapons system operator ejected (the back seat guy was killed when his safety harness broke.) Mistakes like that are made by civil aviation pilots as well, and cockpit electronics are constantly be modified to eliminate as many human errors as possible.