Wildman's answer seems the most correct, with a few details omitted. First, the position and orientation of the transmitting antenna is known, and the same goes for the receiving antenna. These may be the same but they don't have to be. Let's assume they're the same, and that the antennas are parabolic, so they only transmit and receive energy in the direction it's pointing.
The transmitter sends out a short pulse at a known frequency and then switches to receiver mode. The return signal is in line with the direction the antenna is pointing to, and the round trip time gives you the distance. There. You've just fixed the distance to an object in a single direction, so you've located it in 3D space. If you can also measure the doppler shift of the returned signal, you also know the velocity of the object. To do this, the pulsewidth has to be less than the round trip time to the object.
To scan the whole sky you have to rotate the antennae, as well as sweep it up and down in azimuth. For a big dish (the bigger the more sensitivity and directional discrimination) this can be hard to do. With phase array radars, the antenna can be flat and stationary but contains thousands of smaller emmitter/receivers, and by phase shifting the signals from each emmitter independently, interference can sweep the beam over about 180 degrees much faster.
That's the simple answer to how radar works in principle. In practice, with multiple reflections, scattering, ground clutter, etc, let alone active jamming and stealth, things are a lot more complicated.