Use of sensors and lasers seems obvious, but what all goes into the system that achieves this? What does the process entail? Example includes SpaceX's recent autonomous docking to ISS of Crew Dragon.
The Russians have used a docking system known as Kurs for quite some time. Progress, Soyuz, and the ATV (From ESA, using equipment from Russia) dock all the time in automated mode using Kurs.
SpaceX developed its own docking/approach hardware/software and initially tested it on a Shuttle mission before (to pretend to dock along with the shuttle) before using it on the Dragon Cargo capsules.
Once line of sight is established to the selected docking port, the International Docking System Standard (https://www.internationaldockingstandard.com/) in section 3.5 defines three visual targets that can be used to measure the relative orientation between the spacecraft and the port.
There are 3 perimeter reflector targets (PRT) which are retro-reflectors that can be used from longer distances. Once closer there are peripheral docking targets (PDT) and a centerline docking target (CDT). They act similar to iron sights on a firearm.
The targets can be seen on this picture from the IDA-2 prior to installation on the ISS: https://commons.wikimedia.org/wiki/File:IDA-2_upright.jpg.
The PRT are the tiny black features standing a bit of from the port, there are two on the top (one is in a blue clamp) and there is one on the right. The PDT is on the bottom right, you can recognize the circles standing out. The CDT is fixed on the canvas behind the IDA, it is partially obscured in this picture.
Edited to add: While I haven't found definite information on Crew Dragon, on STS-127, STS-129 and STS-133 SpaceX tested the DragonEye LIDAR system which was designed for the old Dragon capsule to locate the retro-reflectors on the station. For the closer approach there is a camera at the center of Crew Dragons docking port, directly opposite to the CDT on the Station.
You can see pictures of the camera on the official NASA video at 27:02:
It's actually quite simple. A spaceship is really have the simplest model of dynamics and control: you have independent control to all 6 degrees of freedom and they are all perfectly linear and newtonian, and you have almost no disturbance or interference. Comparably cars, airplanes and helicopters are all much more complicated (more and more degrees of freedom are coupled together and environment could disturb you badly).
P) the further away, the harder you push (stop pushing when you have reached target)
I) Gradually push harder and harder, when you are far, but be careful not to overshoot (gradually reduce force or push backwards when you are close)
D) watch your speed.
Human astronauts basically does the same thing in manual mode: like this
Everything above is true, but it’s harder than it sounds. Read up on Gemini 4. During that mission, the astronauts tried to fly towards the expended titan booster as a step towards rendezvous. It was a mess. Nothing worked as expected.
Orbital mechanics are pretty counter-intuitive. Your altitude determines your speed, so sometime speeding up means vectoring down, etc. They figured it out by the end of Gemini.
So the astronauts tell the ship to go “that way” and the computers fire thrusters in a variety of directions to make “that way” occur.