Excessive lid oils. Styes are the result of a blocked oil gland on the lid. They are treated primarily with warm compresses--4-5x per day for 10-15 minutes. You can help prevent them by performing lid washes--apply a few drops of non-stinging baby shampoo to a warm washcloth and gently scrub your eyelash area for 30 seconds every night. Also adding flaxseed oil to your diet seems to be helpful in prevention.
Meibomian Glands. A stye is a clogged inflamed oil gland in the eyelid. You probably have meibomian gland dysfunction. You should ask your eye md about this. It is abbreviated "mgd." there are treatments for this which can reduce the frequency that you get styes.
No actual cause. Styes are spontaneous and occur in the impoverished, the unhygienic and the healthy, clean and wealthy. So you cannot change your lifestyle to prevent them. You probably have some change in your body's resistance that you cannot control. Just treat them with the help of your ophthalmologist as they occur.