The nut has to be removed to get the pinion gear out, and the forward gear, if needed. It is held on the shaft with a spline connection and will fall out when you pull the shaft up through the top. You will also need a new nut, as they are designed to just be torqued once and then throw away.
It took me two weeks to get the right set-up to get that nut off. My nut was 1 1/8 inch, and I bought a socket, and I sliced about a quarter to a third of it off, right down top to bottom, so it wouldn't bind on the back forward gear, and used a breaker bar, which was small enough to fit in there, and it would still slip off. I bought another socket and cut off enough to leave 6 of the eight corners, about a quarter of it off. If you slice off a socket, set it up so you are slicing it in the right place to have enough movement, and use an angle grinder with an1/16th inch carbundium cut-off blade. Oh, I used something to wedge the bottom of the breaker bar up, so that it would not slip off, I think I just pounded in a long hardwood wedge to hold it up against the nut. You have to invent tools when working on these older drives. Oh, you also need to hold the shaft at the top, and you need a special spline nut, available on this website, I believe. You can just hold it on the bottom with it all locked-in and turn it from the top with a large rachet or torque wrench. That is how it finally came loose. My nut got rounded off from earlier attempts and there was hardly anything left of it. It may work with an open-end wrench on the bottom if it is small enough and you have some means of wedging it up hard enough to hold, when you turn it from the top.