How is the blocking/cribbing placed and then the ship placed perfectly atop it?
Carefully.
Number of different techniques, but they're all fairly simple in concept and involve reference marks and surveying techniques.
My personal experience is graving docks at a naval shipyard, and all our work was done with tape measures and transits.
First step is the docking plan for the boat. This is generated when the ship is built and provides the locations on the hull and specifics about shape of blocks to match.
Example
This is then used by the engineers at the shipyard to general a dock build plan for the specific docking, taking into account specific blocks that may need to be omitted and where exactly the build is located relative to the dock so the boat is in the right position for work. For instance, submarine refueling requires the boat be positioned in an exact spot relative to various shore facilities.
Graving docks have surveyed benchmarks set on the coping every so often referenced to the dock sill and dock centerline. These would be used
to derive reference baselines for the block build using standard surveying techniques - i.e. measure from benchmark the required distance using a tape and use a transit to transfer that line to the dock floor. Do this for the center of the keel blocks and lines of side blocks relative to dock centerline, and then do another set for fore/aft positioning. Similar idea or block height - leveled transit used to set a baseline height on each block and then measure height on each block relative to that.
End result of this is a block setting that matches the plans and is located relative to specific points on the dock coping.
Same basic idea on the boat - docking plan is referenced to specific features on the ship, and fairly easy to establish a target on the outside of the ship at a known point. On CVNs for instance, the center of the stem is an obvious one, and the centerline aft is easy to locate on the hanger deck. Optical targets are set up at these points, and with some basic math you can figure out where these targets need to be relative to the dock build for the ship to be in the right place, and since you know where the build it relative to dock benchmarks, it's easy to figure out where to set a transit to look at the target as the ship comes in and know that if the target is centered in the transit that part of the boat is in the right spot relative to the blocks. Do this for the bow, stern and a fore/aft reference point and the boat is in the right spot. We would routinely be able to get within 1/2" of the desired alignment.
I've also seen it done using chains hung across the dock. Same basic idea - put 2 chains across the top of the dock with a weighted plumbob hung off the chain in the spot you want a specific feature on the boat to be at when docked. Make it long enough that it touches the floor and you now have 2 reference points to build the setting off of, and then raise them up when docking and move the boat so those points are aligned with the plumbobs