RADAR (RAdio Detection And Ranging) is a technology invented in the 1930s to detect distant objects, mostly aircraft and ships.
Since detection is done by receiving radio waves reflected from the target, RADAR works the same by day and night and in all weather, which makes it a revolutionary long range observation tool, both military, and after World War 2 also civilian.

World War 2 RADAR technology

RADAR works essentially in the same way that a bat uses sound to "see" in total darkness.
The RADAR transmitter produces strong (kilowatts) and extremely short (about a millionth of a second) pulses of radio energy.
The pulses are transmitted thru the air to a known direction by a directional antenna.
When pulses hit an object, such as an aircraft, a ship, or the ground, they are reflected from it.
The reflections are received by the RADAR antenna, and converted by a receiver to an electric signal that can be displayed to the operator.
Since the speed of the signal is the speed of light, the time between the transmission and the reception of a pulse indicates the distance of the target, and together with knowing the direction at which the antenna transmits, the position of the detected target is known.

Initially radars were equipped with display devices like those in an electronics lab (Oscilloscope), but later more operationally useful devices were invented, particularly the PPI (Plan Position Indicator) which is the familiar RADAR display in which a circular display shows a beam which rotates with the rotating RADAR antenna, and marks with light the positions of detected targets relative to their range.

Electronically, PPI works basically like the lab Oscilloscope display, but because of the rotation it creates a map-like display that the operator understands intuitively and immediately, as if he was looking at a map where the RADAR's own position is in the center, and the map position of detected targets are marked with small dots of light.
The operational advantage of this display method was enormous, because it eliminated the need to calculate and check directions on a map. PPI is the map that shows the operator clearly where the targets are.

From military point of view there are basically two types of RADAR, used for detection and for fire control.

Detection radars are used to create a RADAR map of all objects in all directions and often as far as possible.
They are mostly used for purposes such as early warning detection of aircraft and ships, ground controlled intercept of aircraft, which is done by directing fighter aircraft to detected incoming aircraft, and mapping of the ground terrain for navigation and targeting, mostly by bombers.

Fire control radars are the RADAR equivalent of a searchlight.
They are dedicated to the precise positioning of a previously detected particular target, precise enough to aim guns at it and hit it without actually seeing it, or at least to guide the operator so close to it that it finally can be seen, even if only as a dark shadow, and then to aim guns at it and hit it.
Fire control radars were used mostly by night fighters, which were usually twin engine aircraft, larger than day fighters, which could carry not just the pilot but also a heavy RADAR, a RADAR operator, and were heavily armed in order to make sure that the target, a heavy bomber, will be destroyed by the first burst of their guns, because unlike day fighter pilots which could pursuit their target, night fighter pilots could "see" only the narrow cone ahead of them that was "lit" by their RADAR, and unless the target was destroyed, its pilot could immediately break away into a deep dive or other evasive maneuvers and unless it was burning it could quickly disappear in the darkness.

An interesting combination of using a RADAR and a searchlight for fire control was used in anti-submarine aircraft which hunted German submarines in the atlantic.
After a surfaced submarine, or even just the periscope of a submerged submarine, was detected by RADAR, the RADAR operator guided the pilot to it, but since it was such a small target, and one that had to be precisely hit in the 1st attempt or it would disappear, and since radars can't detect below a certain minimum range, the aircraft pilot just had to see the target with his eyes in order to direct the aircraft right over it and drop the depth charges at the right moment.
To be able to do so at night, these bombers carried a powerful fixed searchlight aimed forward, and it was lit in the last few seconds. Early enough for the pilot to actually see the target on the water ahead of him, and too late for the submarine to dive.

Electronic Warfare and Electronic Intelligence

The greatest advantage of using RADAR is that it denies the enemy of the ability to use the element of surprise, of being hidden by distance, by night or by clouds until it's too late to defend against it or to attack it before it disappears.
The response was obvious, the side that wanted to avoid being detected by RADAR wanted to know if and where it was being detected by RADAR, and also to be able to neutralize enemy RADAR in order to regain the element of surprise.
This started a dramatic and secret electronic arms race between RADAR developers and those who develop measures against RADAR, an arms race which continues since World War 2.

The first development was RADAR detectors.
The basic types, carried mostly by bombers and submarines, could tell their operators if a RADAR was transmitting at them (and therefore could detect them) and could estimate if it was near or distant, by the power of the RADAR waves.
The more advanced RADAR detectors were used to analyze everything possible about enemy radars, their power, radio wave frequency, pulse rate, pulse width, and other technical parameters from which engineers could learn a lot about the capabilities of enemy radars, and design "electronic warfare" counter-measures to use against them.

They could also help determine where enemy radars were positioned, so they could be attacked, or bypassed, or in one special case, stolen! - in late 1941, British intelligence noticed that one German early warning RADAR position, in Bruneval, Belgium, was positioned very close to the beach. It was on a cliff, but not far from a path going down to the water.
This was enough for British commandos to raid the isolated German RADAR station in Bruneval one winter night in 1942, dismantle the RADAR, with the help of a RADAR specialist who came with them, and take it all back to England in a motor boat, for a complete analysis of this particular type and of German RADAR technology in general.
(this bold idea was repeated in 1969 when Israeli commandos dismantled and lifted a RADAR in Egypt with helicopters)

Once much is known about enemy radars, they can either be attacked, if they're in range for a precision attack by dive bombers or fighter-bombers, or more commonly they can be disrupted by electronic warfare, which in World War 2 included two main types of counter-measures:

Jammers transmit strong radio waves in the same frequency as the RADAR, which saturate the RADAR receiver with signals so much that it can't see the weaker signals of real targets.

Chaff (nicknamed "window" by the Royal Air Force) are a cloud of thin lightweight strips of metal cut to a specific size, which can be dispersed from a heavy bomber. These strips are designed to be detected by RADAR and therefore instead of detecting isolated real targets, the RADAR operator sees just a huge cloud.

There are various ways for RADAR operators and designers to partially counter these counter-measures, part by having highly trained and experienced operators, part by technological solutions, and part by direct action, using RADAR detectors installed on fighters to locate and destroy the jammer-carrying aircraft.

Notable World War 2 RADAR types

Freya - a German early warning RADAR used to detect formations of allied bombers (range: 125 miles)

Wurzburg - a German GCI (Ground Controlled Intercept) RADAR used to direct fighters, especially night fighters, close enough to enemy bombers that their pilots could then independently intercept them, visually at day, or by RADAR at night (range: 18 miles)

Lichtenstein SN2 - the RADAR of the German night fighters (range: 2.5 miles)

Chain Home - a network of British early warning radars used to defend Britain in the Battle Of Britain.
It was an early and primitive RADAR, but it was powerful and reliable, and was efficiently operated by experienced operators, and therefore was a critical asset which allowed the British Fighter Command to optimally engage incoming German bomber formations. (range: 185 miles)

ASV (Air to Surface Vessel) - this airborne RADAR very dramatically increased the ability of maritime patrol aircraft to detect German submarines in the wide Atlantic Ocean and attack them, and was therefore a critical element in the battle of the atlantic.

SJ - the RADAR used by American submarines to detect Japanese ships and aircraft at night and in bad weather.

H2S - a ground mapping RADAR used by allied bombers for navigation and targeting in long range missions.
German night fighters used RADAR detectors to detect H2S transmissions in order to intercept the bombers despite the electronic warfare against the German radars.