The line segments with the same arrows are to be identified in the direction of the arrows. For example, in fig 3.9, the top and bottom edges are being identified, because they are both marked by the single arrowhead. If you were just given the figures then one way of making this rigorous is to choose parametrizations of both segments consistent with the arrowheads, say the top edge as $t \mapsto (1-t, 1)$ and the bottom edge as $t \mapsto (1-t, 0)$. Now identifying these two segments means to identify $(1-t, 1) \sim (1-t, 0)$ for each $t$, or equivalently $(x, 0) \sim (x, 1)$ for each $x$. If one of the arrows was flipped then the identification would be $(1-t, 1) \sim (t, 0)$.
Implicit in this description is that the resulting quotient only depends on the "orientation" of the parametrization and not the parametrization itself (ie I could parametrize the top edge as $(1-t^3, 1)$ and the quotient I would get would be homeomorphic). In the examples here you actually start with the parametrizations and the figure is inferred so this point is not so relevant.
Since there are no markings on the interior of either figure, by default there are no added identifications on points in the interior, which is consistent with the identifications described. Of course $\sim$ should be an equivalence relation, in particular reflexive, so $p \sim p$ for every point $p$.
For the intuitive description of the identification, there is again the implicit fact that performing these identifications in two steps, first the horizontal edges and then the vertical edges ultimately produces the same quotient. To see that identifying the top and bottom edges produces a cylinder, you can imagine the square is a piece of paper, or if that still does not help, try to perform the identification on an actual piece of paper (square or rectangle, should not matter for this step). If you take two parallel edges of the square, and glue/tape them while matching the arrows, you get a cylinder. The remaining two edges of the square become the two circular edges of the cylinder. If the square is made of (unstretchable) paper then you can't actually glue these edges without introducing folds but if you now imagine the cylinder is stretchable, then you can "bend" it and glue the two circles together. If you keep track of the other double-headed arrows and match them up you should get a cylinder. Here is a picture of the process (taken from the related but more complicated question What surface do we get by joining the opposite edges of a hexagon?):
