How do gallstones form?

Supersaturation! Bile consists of a mixture of cholesterol, bile pigments, and phospholipids. If any of these increase, they can precipitate out and become solidified, forming stones. This is present in 10-20% of people in the US, although usually "silent". Heredity, diet, and age can all play a role.
Sludge. Concentrated bile in the gallbladder solidifies, and gathers in a lump. Most are just agglutinations and can become rounded as rolling together cholesterol-large solitary can also occur bilirubinate.