Why does resistance contribute to the AC impedance's real part for a single circuit, but to its imaginary part for an infinite transmission line? A simple AC-driven RLC series circuit has equivalent impedance
$$Z = R + i\left( \omega L - \frac{1}{\omega C} \right),$$
where $R$ is the resitance, $L$ is the inductance, $C$ is the capacitance, and $\omega$ is the driving frequency.
Now consider connecting an infinite ladder of such circuits to form a transmission line, which has characteristic impedance
$$Z = \sqrt{\frac{\omega L + iR}{\omega C + i G}},$$
where $\omega$ is again the driving frequency, $R$ and $L$ are now the resistance and inductance per unit length along each conductor, $C$ is the capacitance per unit length between the two conductors, and $G$ is the conductance per unit length of the dielectric separating the two conductors.
In the simple circuit, energy loss comes from resistive heating from current passing through the resistor $R$. An ideal lossless circuit has $R = 0$, so the impedance is pure imaginary.
In the transmission line, losses come from resistive heating across the resistor as well as dielectric loss from current leaking across the dielectric that separates the two conductors. So an ideal lossless circuit has $R = G = 0$, and the characteristic impedance is pure real (and also independent of the driving frequency).
This is a little counterintuitive to me. In a simple RLC circuit, the lossy elements contribute to the real part of the impedance, and the lossless version has pure imaginary impedance. But in a transmission line, it's the opposite: the lossy components contribute to the imaginary part of the impedance, and the lossless version has pure real impedance. Why the opposite behavior between the two cases?
I know that ultimately, the answer is just "A single RLC circuit and an infinite ladder of RLC circuits are two very different circuit topologies, so the math just works out differently." But is there a more physically intuitive way to understand this difference?
In particular, what is the characteristic impedance $Z_n$ of a long but finite ladder of n lossless LC circuits? Is it pure imaginary, as in the $n = 1$ case, or pure real, as in the $n = \infty$ case, or does it have both nonzero real and complex parts? (I know that the answer will depend on the boundary condition at the far end of the line, but I assume that the asymptotic behavior for large $n$ will be independent of the boundary condition.) My guess is that as $n$ increases, the modulus $|Z_n|$ interpolates between $\omega L - 1/(\omega C)$ and $\sqrt{L/C}$, and the argument $\arg(Z_n)$ decreases monotonically from $\pm\pi/2$ to 0.
(Final question: in the equation for the transmission line impedance, which branch of the complex square root function do we choose?)
 A: Even in its crudest discrete approximation a transmission line is not a series LC resonator, it is more akin to an LC voltage divider whose output terminals are on the capacitor. Now if you place a series resistor with L and parallel conductance with C, and the "output" hangs off the cap, you have the crudest approximation to a lossy transmission line. It will be less crude approximation as you add repeatedly more sections to it. But even a single section will have input impedance that is not the sum of a resistive part depending only on R or G or the reactive part depending on only L and C see below ($p=i\omega$)
$$Z_1=R_0+pL_0+\frac{1}{1+pG_0C_0}$$
Now when you add another section you will have the resistive values mixing with the reactive ones.
$$Z_2=R_0+pL_0+\frac{Z_1}{Z_1(pC_0+G_0)+1}$$
There is no unique characteristic impedance associated with lumped element circuits in general. If you make a finite periodic ladder out of ideal inductors and capacitors it will form a reactive 2-port whose $2 \times 2$ impedance matrix has no real part, ie., purely imaginary. As you increase the number of elements the impedance matrix converges to the impedance matrix of the transmission line and, notably, the image impedance will approach the characteristic impedance of the transmission line.
As regards the wave impedance, you select the branch of the square root that gives a positive real part because a transmission line is passive.
A: I found the answer to my concrete question in section 11.9 of https://www.ece.rutgers.edu/~orfanidi/ewa/ch11.pdf, which calculates the equivalent impedance of a finite stretch of lossless transmission line of length $d$:

Here $Z_G$ is the internal impedance of the generator and $Z_L$ is the impedance of the load at the far end of a line of length $d$; $Z_d$ is the equivalent impedance that makes these two circuits equivalent at the generator's end. If the EM wave happens to be purely rightward-propagating, then the line impedance $Z_0 := V(z)/I(z) \equiv \sqrt{L/C}$ is independent of position. In general, there will be both a leftward- and a rightward-propagating component, and equation (11.9.2) gives the equivalent impedance
$$Z_d = Z_0 \frac{Z_L + i Z_0 \tan(k d)}{Z_0 + i Z_L \tan(k d)},$$
where $k := \omega \sqrt{LC} = \omega/c$ is the wave number. ($c$ is the effective wave speed through the wire, not necessarily the vacuum speed of light.) Suprisingly (to me), $Z_d$ is periodic with period $\pi/k$, so it doesn't converge at all in the limit $d \to \infty$.
From this expression we can extract various limits and special cases:

*

*If the load is impedance-matched to the transmission line, i.e. $Z_L = Z_0$, then $Z_d \equiv Z_0$ is independent of $d$; there is no reflection for any length of cable.

*If $k d \to 0$, then clearly $Z \to Z_L$, because there is no transmission line in the middle that needs to be removed.

*If the load has zero impedance, then $Z_d = i Z_0 \tan(kd)$ is purely imaginary, unbounded, and periodic with period $\pi/k$. The equivalent impedance diverges if $kd = \left( n + \frac{1}{2} \right)\pi,\ n \in \mathbb{N}$.

*If $Z_L$ is real and positive, then $|Z_d|$ oscillates periodically between extrema (of norm) at $Z_d = Z_L$ at $k d = n \pi$ and $Z_d = \frac{Z_0^2}{Z_L}$ at $k d = \left( n + \frac{1}{2} \right) \pi$. $\tan(\arg(Z_d)) = \frac{1}{2} \left( \frac{Z_0}{Z_L} - \frac{Z_L}{Z_0} \right) \sin(2 k d)$, and $\arg(Z_d)$ oscillates between $\pm \mathrm{arccot} \left( \frac{2 Z_0 Z_L}{Z_0^2 - Z_L^2} \right)$, with the extrema of the argument occuring at $k d = \left(n + \frac{1}{2} \right) \frac{\pi}{2}$. Remarkably, for fixed real $Z_0$ and $Z_L$ but arbitrary line lengths $d$, the set of equivalent impedances $Z_d$ forms a circle in the complex plane with a diameter connecting $Z_L$ and $\frac{Z_0^2}{Z_L}$. (This circle shrinks to a degenerate point in the impedance-matched case $Z_L = Z_0$.)

The fact that $Z_d$ continues to depend on the faraway boundary condition $Z_L$ even in the $d \to \infty$ limit may seem counterintuitive at first, given the local nature of EM. I think the resolution is that $Z_d$ is the steady-state equivalent impedance of the transmission line, and the line will only settle down into this steady state after a time period of order $d/c$, when the wave has had time to proceed back and forth down the line several times. Until the wave has had time to reflect off the far end, it won't know anything about $Z_L$, so all local effects at the generator's end of the line will respond to an effective impedance $Z_0$ for an initial time period that becomes arbitrarily long as the transmission line gets longer.
