How is a lazy eye formed?

Weaker eye. The "lazy" eye is either misaligned and not looking in the right direction, or is less focused than the stronger eye. If not treated at an early age (by age 4), the brain chooses to see preferentially out of the stronger eye. In order not to cause visual confusion, the brain creates a virtual block (scotoma) in front of the lazy eye and becomes unable to use it, even with glasses.
Lack of binocularity. When your 2 eyes don't work together to make one picture, you see double. So your brain stops 1 eye from working so the good eye an see one picture. This is lazy eye or amblyopia. Developmental optometrists can often correct the problem with exercises.