The structure of a neutron star can be summarised as follows.
An outer crust, consisting of a solid lattice of nuclei in a degenerate gas of ultrarelativistic electrons. At densities $>4\times10^{14}$ kg/m$^3$, there is an inner crust where it becomes energetically feasible for neutrons to drip out of the nuclei, but the (increasingly n-rich) nuclei maintain their identity in a solid lattice. As densities $>10^{17}$ kg/m$^{3}$ the nuclei lose their identity and "dissolve" into a (super)fluid of degenerate neutrons with a small fraction (1%) of protons and electrons. Then at densities approaching $10^{18}$ kg/m$^3$ there may be some other phase change - either into a solid neutron core, quark matter or through the creation of additional hadronic degrees of freedom.
Nuclear pasta fits into the region between the inner crust and the n,p,e fluid, at densities between about $3\times 10^{16}$ kg/m$^3$ and $10^{17}$ kg/m$^3$. The basic idea is that the equilibrium state of the gas is found by minimising the overall energy density.
$$ u = n_N (M(A,Z)c^2 + L) + u_n + u_e + ,$$
where $n_N$ is the number density of nuclei, $M(A,Z)$ is the rest mass of the equilibrium nucleus of atomic mass $A$ and atomic number $Z$ (inverse beta decay drives the equilibrium towards n-rich nuclei with large $A$ and high $A/Z$), $u_n$ and $u_e$ are the energy densities of the degenerate neutron and electron gases, which depend only on their number density. $L$ is a (negative) energy density associated with the lattice of nuclei - i.e. some sort of crystal lattice has a lower energy.
The key thing here is the $(M(A,Z) + L)$ term. At lower densities it can be assumed that the nuclei are relatively isolated and pseudo-spherical, so that a semi-empirical mass formula will yield an estimate of $M$. But at densities above $3\times 10^{16}$ kg/m$^3$, the nuclei fill more than 10% of the volume, they are surrounded by neutrons that reduce the surface energy term, and they are becoming so large ($A>300$) that they become susceptible to fission (c.f. the Bohr-Wheeler condition for spontaneous fission).
What this means is that the equilibrium structure of the nuclear matter is no longer in the form of pseudo-spherical, individual nuclei. The nuclei distort and join together in various density-dependent forms; first spaghetti - long strings of nuclear matter with a neutron sauce; then lasagna - planes of nuclear matter with a neutron sauce. At even higher densities the roles reverse - the neutrons are in strings and planes surrounded by nuclear matter.
At densities above $\sim 10^{17}$ kg/m$^3$ the binding energy of the nuclear matter becomes so low that it is more favourable for the nuclei to dissolve into free neutrons (plus a few protons and electrons).