Thread worms lay their eggs around the anus.
The eggs cause itching, you scratch, bit your nails and re-infest yourself. This is one method. Ditto kids passing the eggs round in the sand pit.
Once one member of the family has them, the eggs can be passed from person to person via the lungs.
The eggs are microscopic and fly into the air when you make beds, sort clothing etc. You breathe in the eggs, which go down deep into the lungs.
There are tiny hairs in the lungs called cilia when beat dirt and dust , bacteria, and eggs which get trappen in mucus produced by goblet cells (great name eh??) up and up the bronchi and trachea until the mucus and crud tips into the oesophagus (this happens all the time btw, we just don't sense it happening).
The eggs pass into the stomach, and are protected from the acid. they then pass into the alkali small intestine, where the hatch, and the whole merry process starts all over again.
Some female thread worms actually allow themselves to dry out at the anus, so they explode and send their microscopic eggs floating in the air!