A tap (for an internal thread) or a die (external thread) is used for this. We have a hole that we machine with a tap. This is a tool that resembles a screw.
It has grooves (straight and helical) for chip removal (removed material) and teeth / cutting edges that cut into the wall of the hole.
The tap needs to be lubricated with lubricant during the process according to the material we are machining.
For manual threading, we use set taps (each one replaces the previous one and cuts a larger and more precise thread. They remove 60, 30 and 10% of the material).
Machine or nut taps are used to cut threads in a through hole / bore.
Another method of machining is using forming taps. Unlike the previous version, where the tap cuts a helix/groove, this type squeezes it into the material. Therefore, it does not remove chips. Thanks to this, they do not have cutting grooves and do not weaken or become brittle.
However, this method can only be used with ductile materials.
Other articles:
Jak se dělají závity?
Povlaky závitníků
Nejlepší průmyslové oleje a maziva - kdo maže, ten jede
Jak vybrat strojní závitník?