For a spanning tree, the formula for degrees of 1 node is (where n_i is number of nodes of degree i):

n_1 = 2 + n_3 + 2n_4+3n_5+...

How do I derive this formula?

The only thing I know is the total number of degrees in the tree equals

n_1+2n_2+3n_3+...