First some demolition:
There’s actually a lot more going here than meets the eye. First, a structural model of the building is created. Buildings and bridges are overbuilt, such that the structure is capable of supporting considerably more load than it’s actually required to hold. This allows for minor failures to occur during the construction and life of the building without it collapsing. Once the model is built, they determine what support members may be removed without collapsing the structure, taking it from a safety factor of 1.5 (50% stronger than necessary) to 1 (just strong enough to stand). The analysis is carried out or overseen by structural engineers.
Next, charges are laid on some support members, like columns and beams, but not others. The idea is to leave parts of the building connected by steel girders to parts that will fall so they get pulled in that direction and fall on top of the pile. Gravity does the actual demolition, the charges just break the supports.
Finally, the charges are detonated in a careful sequence. First are a series of weakening charges that remove the 50% of support safety margin, then the building is collapsed from bottom to top and (usually) from the center outwards to the periphery, with the back and sides being pulled into the center debris pile.