The general way this is done is to leave fixed sums as legacies to individuals such as friends and then the rest of the estate by dividing the residue of the estate equally between children.
Thus if the willmaker wants to leave a specific legacy to a granchild it is done as a fixed sum.
The way that potential death of a child of the willmaker beforehand is dealt with is by using the sort of wording as follows:-
'to divide the residue of my estate equally between my son (name) and my son (name) and my daughter (name) and (so on for all of them) but if any of these children should die before me leaving children those children shall on attaining eighteen shall take the share which their parent would otherwise have inherited.
That way, the will doesn't have to be changed every time an unfortunate death occurs in the family.