I know that those plane had radar to acquire an approximate location of the enemy, but how did they spot them after that? You need to be accurate when you try to shoot down an enemy plane, and deflection can be tricky, even at close range. So how did pilots aim in those conditions?
The night fighting in WWII was mainly between the RAF and Luftwaffe, with the Luftwaffe fielding most of the night fighters due to necessity (the others too had some fine night fighters, though none had their need as much as the Germans).
The first stage in (trying to) shoot down enemy aircraft is to find them. This was mainly done by the ground based radars. The second one is fixing them- this is where the aircraft based radars came into being.
Initially, the fixing of aircraft location was done using ground based search lights, which were sometimes controlled by radar after which the fighters attacked the illuminated target- but this was of little use as was the aircraft based searchlights. It was only in the middle of the war did the development of night fighters gained pace.
A Messerschmidt Bf 110 G-4 night fighter with FuG 202/220 Lichtenstein radar; By Max Smith - Own workMoved from en:Image:ME-110G-2_at_RAF_Hendon.jpg, Public Domain, Link
The night fighters were usually twin engined aircraft fitted with radars, though there some single engined ones too. The fighters were still vectored into the bomber locations using the ground radar controller. An RAF report on PoW interrogation notes:
...The crews fly by D.R., and the loose formation is simultaneously tracked on a map at Gruppe headquarters. If, in the light of the movements of the bomber force a change of course is necessary, a new bearing will be given to all aircraft simultaneously through the Gruppe commentary.
All crews are given strict orders to navigate by D.R., and to accept the Gruppe orders if these differ from their own calculations ...
Once the fighters were near the bomber stream (as the RAF usually bombed in strength to overwhelm the defences), they were given a new bearing to intercept the bombers.
... the string of night fighters should be brought up to the bomber stream on a parallel or nearly parallel track. At the correct moment, and in accordance with D.R. tracking at headquarters, the night fighters will be given a new bearing which turns the whole line on to the bomber stream in a broadside.
The enemy aircraft (bombers) were identified by their silhouette (against moon or the burning cities below) or by their exhaust flames.
Recognition of the target aircraft is usually by the silhouette in light conditions or moonlight, and by the four exhaust flames in darkness.
The actual firing of the guns depended on the pilot and different ones opted for different methods- some simply did as in dogfights during day- get into the rear and shoot up, though the rear gunners made this difficult. Others moved towards the aircraft from the sides and a little low, after which they pulled up near the aircraft and aimed for the wing fuel tanks.
The range at which the night fighter opens fire with its forward armament is determined by the pilot himself; whilst some will close in as near as 50/60 metres, the more cautious will open up at a range of 200/250 metres. P/W considered, however, that the normal range might be taken as l00/150 metres.
One of the effective methods used by Germans was the upward firing cannon called the Schräge Musik, which was quite effective with its 20 and 30 mm cannon.
Basically, the pilots flew under the bomber and fired the Schräge Musik. This was quite effective as the bomber crews had little warning of the threat below and the bullets usually tore through the fuel tanks near wing roots.
[These P/W] ... they stated that once this armament (Schräge Musik) could be brought to bear it was extremely effective; one officer had claimed a kill with two rounds from the 20 mm. cannon.
The night attacks were quite short affairs as it was quite difficult to keep the bomber in crosshairs for any amount of time (and there were enemy night fighters to contend with). Shooting down enemy aircraft took more luck than skill in WWII. According to this site, each enemy aircraft shot down required more than 10,000 rounds fired (the values are more or less equal for both sides), with night attacks probably requiring more ammunition. Also, this infographic has some good details on this subject.
There are so many inaccuracies and omissions in @aeroalias' answer that I take it upon myself to add another answer.
Early Years (1939 - 41)
Up until the start of the war, aircraft were located by listening stations. By feeding each ear with a super-sized, moveable ear trumpet, both direction and elevation of an approaching aircraft could be determined by a trained observer. Another method were large, spherical concrete mirrors with a moveable microphone placed in front of them.
Soldiers operating an acoustic airplane locator during World War 2, Trelleborg, Sweden, 1940 (Picture by Carl Gunnar Rosborn, source)
This could only provide an early warning and an approximate location which was then radioed to the fighter aircraft. Those had to rely on their eyes to find and attack the aircraft, which was relatively easy in moonlight. The hard part was to navigate back to the airfield.
When the war started, Britain had nearly completed its Chain Home early radar installation while Germany had just fielded eight of the more advanced Freya stations. Both could detect aircraft at greater distances and accuracy than listening stations and Freya even provided early friend-or-foe capabilities with properly equipped aircraft. While the Chain Home system relied on direction and speed to distinguish between friendly and hostile aircraft, Freya stations (which were later completed with Würzburg stations for height finding) could already direct individual fighters to their targets. Tracking was manual and detection errors frequent.
The fighters were regular single- or twin engined aircraft and initially their only modification was a black coat of paint as camouflage. On both sides, otherwise obsolete designs were used successfully as night fighters. On the British side, a few like the Boulton Paul Defiant were designed from the outset to fend off intruding bombers, day and night.
Low-level aerial reconnaissance photograph of the Freya radar installations at Auderville, France, 1940 (picture source)
Since bombing raids by the RAF on civilian targets started already before the end of the "phoney war", I will focus on Luftwaffe tactics:
- Dunkle Nachtjagdt ("dark night hunt") The fighters assembled over a radio beacon and were individually led to their targets via radio commands coming from a Freya station. At close range visual identification was used to target and shoot.
- Helle Nachtjagdt ("light night hunt") Here a trio of searchlights was slaved to one Würzburg station and a second Würzburg was used to track and direct the fighter while the Freya was used for long-range detection. When the three light beams converged on their target, the fighter could use this illumination for the final approach and targeting. Due to the scarcity and immobility of searchlights this technique only worked when the bomber track was close to the searchlight stations. This worked best with little or no cloud cover, but bomber navigation also required cloudless skies, so this technique worked well initially.
Intermediate Years (1942 - 43)
A big improvement in accuracy was the addition of lobe switching to the radar systems. A rotating, slightly offset receiver in the focal point of the Würzburg antenna produced a spherical scan, and the operator could compare the returns of the radar blips to direct the antenna in the direction of the aircraft. If all returns were of equal height on the oscilloscope screen, the antenna pointed directly at the aircraft. Next, a hierarchy of command stations was built up to collect the information from all radar sites and direct the fighters centrally. Larger and more powerful systems were deployed with better accuracy and range. Also, the display of aircraft locations was refined: The command stations had plotting tables (Seeburg-Tisch) with a map on which the aircraft were displayed as light dots, so the Jägerleitoffizier (fighter command officer) could better direct the fighter.
Countermeasures were the focusing of the bomber stream on a narrow range of the belt of radar stations and searchlights (Helle Riegel) from 1942 on, so they were simply overwhelmed. Remember, three radar stations were needed to direct one fighter to one target. In 1943, the RAF added the dropping of clouds of strips of metal foil (Window), the length of which was tuned to the radar wavelength, thus over-saturating the radar returns. As a response, the rigid system of a single line of defence (Kammhuber line) was broken up into a number of stations around possible targets for in-depth defense, and fighter aircraft were equipped with their own radar system to give them more independence. British Bristol Blenheims and Beaufighters had early onboard radar systems installed as early as 1940, their development prompted by the low accuracy of the Chain Home system. Also, airplane-mounted infrared searchlights and infrared receivers were tried out but were found to be lacking.
The Seeburg-Lichtenstein-Verfahren, called after the plotting table and airborne radar, still needed long range detection by ground based radars. In that, it was helle Nachtjagdt without searchlights. By adding simple direction and range finding ground equipment for directing the actively radiating fighters, the Y-Verfahren could switch all radars to the tracking of bombers, thus doubling the number of intercepts which could be managed by one Himmelbett station (a ground station with added fighter tracking equipment). However, now the fighters would give away their position also to the enemy, and specially equipped RAF fighters could home in on the radio signals of the Luftwaffe fighters.
Radio operator instruments in a Me-110 G-4 (picture source)
Late Years (1944 - 45)
A steady stream of improvements saw a move to higher frequencies (to reduce antenna drag) and variable frequencies (to tune away from chaff), but the general tactic of centrally directing fighters into a larger area and leading them near their targets with large, ground-based radars was maintained until the end of the war. By using PPI displays, those radars could cut through chaff and became effective again in directing fighters, because the detection range of their onboard radars was still limited. Both sides used the emission of aircraft-mounted radars to home in on the enemy, using passive detectors.
When the number of allied aircraft overwhelmed the limited number of dedicated night fighters, regular day fighters were used in parallel in increasingly desperate ways. After General Kammhuber was replaced in his position as head of night fighters by the much more aggressive Hajo Herrmann, new tactics were developed:
- Zahme Sau (tame sow) saw the use of FW-190 and Me-109 (Herrmann himself flew at times an aircraft carrier variant of the 109 E which was outdated for daytime use in 1944, but fine for night fighting) aided by illumination from flares dropped by high-flying Ju-88s. Later addition of passive receivers aided greatly in leading them to their targets, and without active radiation sources they were immune against countermeasures. Also, the radars would now multi-task, leading several fighters in short sequence to their targets. This way, a single Himmelbett installation could direct 15 fighters.
- Wilde Sau (wild sow) While Zahme Sau kept reserved areas for ground-based anti-aircraft fire, Wilde Sau extended the concept to mix AA and night fighters. By staying above the altitude at which AA grenades would explode intro shrapnel, the fighters were supposed to avoid being hit by friendly fire, and the FlAK searchlights helped in navigating to the bomber stream and picking up targets (most effective when shining against a lower cloud layer). Again the problem shifted to finding home after an attack, and elaborate radio navigation aids and ground illumination was used to help the fighters find home.
By Eating Carrots...
And yes, I realise that this answer isn't technologically correct, but psychology and propaganda can have an affect on the effectiveness of the opposing forces during war.
Although there's no real proof that this particular campaign actually had an effect on Luftwaffe night pilots, it's possible that the thought of the Allied pilots being better fed might have had some kind of effect...
While I agree that much of the nocturnal effectiveness of air combat due to technology, psychology always has some part to play...