I'm reading a book about structures on collections, chapter equivalence relations, and I try to get through the explanation of transitive closure. They use the following example:
$A$ is a collection of people. In $A$ the relation $R$ is defined by $xRy$ if $x$ is a parent of $y$.
This parent relation is a relation that is not transitive. Surely, if $a$ is a parent of $b$, and $b$ is a parent of $c$, then $a$ is (in general) not a parent of $c$. Using the parent relation we can define the ancestor relation: $a$ is an ancestor of $b$ if there exists a string of people $c_1, c_2,\ldots, c_n$ for which $a = c_1$, $b = c_n$ and $c_i$ is a parent of $c_{i + 1}$ for each $i \in \{1, \ldots, n - 1\}$. The relation 'ancestor of' is transitive.
We shall now look how we can define the grandparent relation from the parent relation. Let $R$ be the parent relation, $R = \{(x, y)\mid x\text{ is a parent of }y \}$. Then we have: $a$ is a grandparent of $b$ if there is a $p$ of which $a$ is its parent and $p$ is the parent of $b$. The relation 'grandparent of' is then equal to the collection $\{(x, y)\mid\text{there is a }p\text{ for which }xRp\text{ and }pRy\}$.
This last sentence is what confuses me. How exactly does this collection have $(x, y)$? Because to me it seems that what is in the collection is $x\to p\to y$, and not $x\to y$. I cannot for the life of me figure out how this definition is tying $x$ to $y$.
You are confusing between two different ways of expressing relationships. A relationship on the elements of a set is the collection $R$ of ordered pairs $(x,y)$ such that $x$ is related to $y$ if and only if $(x,y) \in R$. We also express the fact that $x$ is related to $y$ as $xRy$. Thus, a relationship $R$ is a collection of things that we write as $xRy$ for different choices of $x$ and $y$, which we could also write as a collection of ordered pairs $(x,y)$ and name the collection of ordered pairs as $R$! So, define $$\begin{align} P &= \{(x,y) \colon x ~\text{is a parent of}~y, ~\text{that is},~ xPy\}\\ G &= \{(a,b) \colon \exists ~ p ~\text{such that} (a,p)\in P ~\text{and}~ (p,b) \in P, ~\text{that is},~ aGb \} \end{align}$$ as the parent and grandparent relationships.