On the construction of hyperelliptic Riemann surfaces.

I have seen two ways to construct hyperelliptic curves, and it seems to me that the intuition behind the change of coordinate is not the same. I like better the second construction (which is pretty topological), but understand better the intuition of the first one (which is more analytical).

First construction. In my lecture notes, one constructs an hyperelliptic curve as follow : consider the Riemann surface $X \subset \mathbb C^2$ defined by $y^2 = p(x)$ for some polynomial $p(x) = (x-a_1) \dots (x-a_k)$ such that $a_i \neq a_j$ whenever $i \neq j$. Then, the holomorphic function $\pi \colon (x,y) \mapsto x$ is a ramified covering of degree 2 (the branching points being $a_1, \ldots, a_k$).

The idea is now to extend this ramified covering to a application $\tilde X \to \mathbb P^1$ of degree 2. In order to do that, observe that when $x \to \infty$, also $y \to \infty$, and let be two new local coordinates $z = 1/x$, $w = 1/y$. Then pulling back a small punctured disk centered in $0$ by $z$ and rewritting $y^2 = p(x)$ as $w^2 = 1/p(1/z)$, it appears that we can extend $\pi$ above $z = 0$ by one or two points depending of the parity of $k$. We then have the wanted $\tilde X$, compact Riemann surface.

Second construction. (Ref. Rick Miranda's Algebraic Curves and Riemann Surfaces) As before we have $X \subset \mathbb C^2$ and we also construct $Y \subset \mathbb C^2$ defined by $w^2 = z^{2m} p(1/z)$ where $k=2m$ or $2m-1$. Then let the biholomorphism $$\varphi \colon \{(x,y) \in X \mid x \neq 0\} \to \{(z,w) \in Y \mid z \neq 0\}, (x,y) \mapsto (z,w) = (1/x, y/x^m),$$ and we obtain $\tilde X$ by glueing $X$ and $Y$ over $\varphi$.

Question. What is the intuition behind the change of coordinates $z=1/x$, $w=y/x^m$ in the second construction ? It does not seems natural to me, whereas the change $z=1/x$, $w=1/y$ does. In other words, where does it come that we set $Y$ as the locus of $w^2 = z^{2m}p(1/z)$ ?

Not sure this answer can give an "intuition", but at least some sort of explanation of why it makes sense to consider the change $w=y/x^m$. The idea is that you start with the curve $y^2=p(x)$ in $\mathbb{C}^2$ and want to define some smooth compactification of it. The easiest idea would be to take the projective closure in $\mathbb{P}^2$, but a direct computation shows that this procedure always adds exactly one point, which is singular as soon as $k\geq 4$, so this does not work.
Another approach is to consider a line bundle $L$ over $\mathbb{P}^1$. Over an affine chart $\mathbb{C}\subset \mathbb{P}^1$ the bundle trivializes, giving a copy of $\mathbb{C}^2$. Then you take your curve $y^2=p(x)$ in "this" $\mathbb{C}^2$ and consider the closure of it as a subspace of the (total space of the) line bundle $L$. To do this you need to check what happens in the fiber when you go to the other affine chart $\mathbb{C}\subset \mathbb{P}^1$ via $z=1/x$. Fact: line bundles on $\mathbb{P}^1$ are classified by their degree, thus $L$ will be of the form $\mathcal{O}(k)$ for some $k$; the change of coordinates in the fibers of $L=\mathcal{O}(k)$ is exactly given by $w=y/x^k$. Direct computations show that the right choice of $k$ (i.e. of $L$) allows you to extend the curve adding one or two smooth points over the point at infinity in the base (i.e. $z=0$). The curve you have called $Y$ is exactly the affine part of this compactification in the trivialization of $L$ over the $z$-chart, and the values you have written for $k$ are the right ones, of course depending on the parity of $deg(p)$.