So, assuming modern architecture means roughly mid-century architectural styles like international style and brutalism, there were a number of factors, but a couple major ones were: 1) Simply changing tastes that moved away from heavy ornamentation to simplicity and clean lines. The intricate classical designs like Corinthian columns and Richardsonian Romanesque arched windows began to look old-fashioned. And 2) materials like steel beams, large plate glass, and poured concrete became much cheaper, expanding what could be done.
Electricity did play a role. While there are non-electric elevators, they are more limited in what they can do, and the electric elevator, in conjunction with new structural systems created with steel, concrete, and glass, allowed architects to really go up. Imagine having the top office in the Seagram Building if you had to climb the stairs. The cheap electric lighting also meant that architects had to worry less about getting light into the interior of buildings. And finally, new electric HVAC systems meant that the architects didn't have to think as much about passive heating and cooling. Going back to the Seagram Building, imagine if there wasn't a/c--you'd have to have operable windows, which would have changed the entire look of the building.
Modern Architecture (Oxford History of Art) by Alan Colquhoun goes into more detail about the factors that played into the creation of modern architecture.