1st daughter after maternal grandmother
2nd. daughter after paternal grandmother
3rd daughter after mother
4th daughter after mother's oldest sister or maternal great grandmother.
1st son after paternal grandfather
2nd son after maternal grandfather
3rd son after father
4th son after father's oldest sister or paternal great grandfather
Often the children would have the mother's maiden name as a middle name or that of the grandmothers. In some cases the middle name would be the surname of the minister who christened the child.
Some of my ancestors were named after family friends e.g. my grandma Lindsay's brother. I also have some ancestors that I have no idea who they were named after, and don't even try to match up the last two or three generations too closely to the naming pattern because you'll get tied up in a knot :)
You might also come across a baby being named after a deceased older child. In many instances this was to keep the naming pattern intact.