Silicon Valley investors that helped build the solar industry are shifting cash into electricity-grid technology and energy-storage developers after bets on panel manufacturers failed to pay off.