This is from emedhealth:
Sty OverviewA sty is an acute infection of the secretory glands of the eyelids.
This common infection results from blocked glands within the eyelid. When the gland is blocked, the oil produced by the gland occasionally backs up and extrudes through the wall of the gland, forming a lump (chalazion), which can be red, painful, and nodular. Frequently, bacteria can infect the blocked gland, causing increased inflammation, pain, and redness of the eye, and even redness of the surrounding eyelid and cheek tissue. The medical term for sty is hordeolum.
The lump can point externally (outward) or internally (inward). Frequently, the lump appears with a visible whitish or yellowish spot that looks much like a large pimple. Usually, one obvious area of swelling is apparent on one lid, but many styes can appear on one or both eyelids simultaneously.
The lump frequently goes away when the blockage of the gland opening is relieved. Furthermore, the infection goes away when the pus is drained from the sty.