The probe and drogue were used first to "soft dock", putting the CSM and LM into rough alignment. Then the probe was retracted by pneumatic pressure from a gas (N2?) cylinder, pulling the two together until their flanges met. Then a set of spring-loaded latches (on the end of the CSM tunnel, I think) fired to hold the two spacecraft together tightly; this was a hard dock.
At this point there was a gas-tight seal between the two spacecraft. A vent was opened to allow oxygen into the space between the CSM and LM hatches. Then the space was isolated again and the pressure monitored to check for leaks to space. If there were none, the CSM hatch could be opened and the probe and drogue removed and stowed. An umbilical cable was then connected to carry CSM power to the LM to save the latter's batteries. (This cable's function was reversed during Apollo 13 to carry LM power back to charge the CM's re-entry batteries.)
Docking was done twice: shortly after TLI, and after the LM returned from the lunar surface. The LM jettison was done more definitively, by firing shaped charges that cut the CSM tunnel just above the hatch. The probe, drogue and latches were all left attached to the LM to eliminate their weight from the CSM. In several pictures of jettisoned LMs you can see the latches sticking out of the top of the LM.