The biggest U.S. tech companies are providing a jolt to the slumbering commercial real-estate business, emerging as major tenants and acquirers of office and other space while many nontech firms are trying to tear up their leases.