How do pick and place machines pick up components?
Using a vacuum pickup. Those are handheld ones, but the machine has one on a robot arm with XYZ control.

It's very simple, just a tiny suction cup with a vacuum that can be turned on and off.

The components are placed onto the solder paste which is slightly sticky, so small vibration won't dislodge them. If the board will be double-sided, a small dot of glue is added before the component is placed. This prevents the components falling off when the other side is being soldered.

Then the board goes through the oven, is subject to optical inspection to check that the parts have soldered correctly, and any parts that can't be handled by the pick and place machine are hand-fitted and hand or wave soldered. This is usually only required for big connectors.