Tech has offered investors some of the biggest returns over the last few decades—and especially the last few years—but over the long run, investors have seen massive gains from all over the market.