That is a very 'old school' component. Older engines used a distributor. When manufacturers started using direct ignition such as coil packs or individual ignition coils to create the necessary high voltage spark, they were still using engine blocks that were designed for a distributor. Instead of designing an entirely new engine block to meet the needs of the direct ignition system what they did was cleverly engineer a cam position sensor(also referred to as a synchronizer) that could be installed in the exact same location that was originally intended for the ignition distributor.
You can see from the video that the cam position sensor is gear driven by the cam shaft.(just like a distributor) The sychronizer is used as a reference so that the engine control module(ECM) knows the exact position of the camshaft and subsequent position of the valves. With that information, the ECM knows which spark plugs needs to be 'fired' and when.
Modern day engines use multiple cam sensors(usually when the engine has more than one camshaft) that are no longer mechanically driven by the cam. Instead they are mounted near the end of the cam shaft and are usually magnetic based sensors that detect both speed and position of the camshaft.
The cam shaft position synchronizer as seen in the above videos are not used for adjusting cam shaft position. That job is done by Variable Valve Timing(VVT) systems. Each manufacturer has their own name for it. Toyota calls is VVTI, BMW calls it VANOS.