Nodal Analysis of a Circuit
The sum of all currents must equate to zero. 



All they did in your example is the following

i4 = i1 + i2 + i3

where 

\$i_4 = \frac{20-v}{R4}\$

\$i_1 = \frac{v-50}{R1}\$

\$i_2 = \frac{v}{R2}\$

\$i_3 = \frac{v}{R3}\$

[edit] because of comment about choice of direction of current

To add another example


I randomly chose the direction of the currents. It doesn't matter what direction I choose (the math will work itself out) so long as the the sum of currents and exiting the node is zero.

Looking at my example here, 
I'm going to say that current entering a node is positive, and current leaving the node is negative. It doesn't have to be this way, it can be the opposite if you want, but I chose this convention. With that said, that means

\$ i_1 + i_2 - i_3 - i_4 =0\$ because current entering a node I've defined as positive and current leaving a node I've defined as negative.

\$i_1 = \frac{50-v}{R1}\$

\$i_2 = \frac{-v}{R2}\$

\$i_3 = \frac{v}{R3}\$

\$i_4 = \frac{v-20}{R4}\$

When you plug these into the equation above, you can isolate v and you'll get v= 31.147V.

So it doesn't matter which direction you think current goes, so long as you define the direction first, then write the equation for the node with your chosen direction, it'll work out.