Your own observation of symptoms. Medical history and physical exam by a doctor. Microscopic study of the worms or eggs. Doctor's treatment with medication. Treatment should include all family members at once.
Recurrence is common.
Clean the house with extra care. Wash the sheets and clothing with extra bleach or ammonia, or boil them. Scrub washable toys. Sterilize metal toys and similar objects in a hot oven. Cut and clean fingernails.