Glass is fragile and can break for a variety of reasons. How you handle and repair glass depends on first identifying the type of glass and diagnosing the reason for the breakage.
Glass often breaks when it is struck by an object. A ball hitting a window or a pebble striking a windshield often results in cracked or broken glass. Impact breakage usually results in a circular pattern centering where the object hit the glass. The pattern of an impact break often looks like a spider web embedded in the glass.
Glass manufacturers anneal glass by holding it a temperature for a period of time during the manufacturing process so that the internal stress in the glass is reduced. If the glass was not properly annealed, the glass will crack, break or explode. The break pattern for sheet glass subject to stress crack will be linear rather than circular (as in an impact break).
A nick in the edge of glass is subject to expand. Edge cracks produce a linear pattern leading from the crack in the edge of the glass.
Sometimes glass just breaks. Most of the time spontaneous glass breakage is the result of improper annealing of the glass by the manufacturer or thermal shock of the glass during normal usage. Pull a glass out of the oven or dishwasher when it is hot and place ice water into the glass and it may break due to thermal shock. These breaks tend to be linear and not circular.
Tempered glass subject to stress cracks, cracks in the edge or impact will simply shatter and you may never be able to discover the cause of the break.