The following genealogy was sent to me by a genealogist in Aberdeen. Remember she was addressing someone who knew nothing.
The earlier generations were called Lord Hay of Yester (from 1487). One of them was made Earl of Tweeddale by Cromwell in 1646, during the Covenanting period. He was against Charles I, but his son changed sides and was for Charles II, and therefore got the upgrade to Marquess. The younger sons of the family would have an estate bought for them and be known by its name, e.g. Hay of Drumelzier, Hay of Spott, etc. Sometimes these estates came into the family through the wife's dowry.
Your William was born 30 Dec 1699. His parents were Alexander Hay of Spott and Catherine Charters, who were married 22 April 1697. William was the 2nd son, and inherited Lawfield on the death of his unmarried brother, Robert.
His father, Alexander, was a younger brother of the 2nd Marquess of Tweeddale. Their parents were John Hay, 1st Marquess of Tweeddale (the one who was a Colonel in the Covenanting Army, but then changed sides) and Jean, daughter of the Earl of Buccleugh.
My insertion follows.
This is where the Charles II comes in. I have read that the first illegitimate son of Charles II was made Duke of Buccleugh. Jean is our link to Charles II.
His parents were John Hay 1st earl of Tweeddale and Jean, daughter of the Earl of Dunfermline.
His parents were James Hay, 7th Lord Hay of Yester (Note -not Lord Yester) and Margaret, daughter of the Earl of Lothian.
His parents were William Hay, 5th Lord Hay of Yester and Margaret Kerr. This was another one who changed his mind, starting off supporting Mary Queen of Scots, fighting for her at the Battle of Langside, but them swooping to the opposition a year or 2 later.
His parents were John Hay, 4th Lord Hay of Yester and Margaret, daughter of Lord Livingstone. He spent some time in the Tower of London as a prisoner of war.
His parents were John Hay, 3rd Lord Hay of Yester and Elisabeth, sister of the Earl of Angus.
His parents were John Hay, 2nd Lord Hay of Yester and Elizabeth Crichton. He died at the Battle of Flodden.
His parents were John Hay, 1st Lord Hay of Yester and Mariot, daughter of Lord Lindsay.
Remember, I do not know your history as well as you do and spelling may not be 100 percent correct.