In opening WSC 42 to my children yesterday, we noted that the sum of the law is our relation to the Lawgiver. The second great commandment flows from the first because man is made in God's image.
One thing I forgot to tell them this time (though we have done, many times) is that man's being made in God's image is because of how God had decreed to make the ultimate display of Himself and His glory in the Son: as the incarnate God and Savior.
In this way, the sum of the law is intimately tied to knowing Jesus as God, glorifying Jesus as God, loving Jesus as God, and enjoying Jesus as God.
Apart from this, there is neither loving God nor loving neighbor. The proper way to love God is to know and love Him especially through His Son. The proper way to love oneself is to love God in this way. And the proper way to love our neighbor is to aim, in all of our law-keeping, at his loving God in this way.