Starting over a year before, works are planned. Months before, preparatory work is done and assets are pre-staged.
Here's a hypothetical case. They want to replace worn rail and convert to a new signaling system.
2 years before
Signaling has been slowly installing new conduit pipe along the tunnel, and new equipment boxes right next to the existing boxes and signals. Holes are drilled in the old equipment boxes to allow a cable to exit them, and plugged with a hole cover.
The track department has been slowly loosening, coating with release compound, and retightening all the bolted clips which hold the rails to the ties. This involves a great deal of fighting rust-frozen bolts that haven't turned in 20 years. Any particular bolt might take 2 minutes, or might take an hour dodging several trains in the interim.
Stations have sent through public approval a facelift for the station.
1 year before
Signaling has been slowly populating those new conduits with cabling.
Track is continuing the bolt loosening, and is replacing ties which are too broken to be reliably unbolted on Rail Change Day. They have also been installing spacers and anchors where needed so the new rails can't touch the inner third rail. They didn't do anything this Christmas; that was for the power department to replace the worn third rail.
Stations have been setting rock bolts in the ceiling and walls of the station, as needed to attach new fixtures. They have been running new conduit for the new lighting, power and signaling.
3 months before
Track has squeezed through a rail train when able, and dropped off 2 miles of new rails in 1/4 mile sections. These are just laid down in between the running rails, on the spaecers previously provided if needed. Some people think they are extra third rails; they are not. They drill holes in the old rails to match a traditional bolted track joint, then make a saw cut and bolt the joint. This is now a bolted (cli-clack) joint.
Signaling is busily racking equipment in the new cabinets, and cabling them up to the new conduits. A flexible cable runs to a temporary, miniature signal head, just three little LEDs which allow signalers to diagnose that the new equipment is working properly. Leech circuits are added to the old signal system so the new can tap any old sensors that will be retained.
Stations are now cordoning off small areas of the station at a time, off-peak, and installing all the new fixtures they possibly can.
Three days before
Track issues a "slow order" on the track section, slowing trains. They remove progressively more of the clips holding the rails to the ties, slowing trains further as they do. The last few trains run at 10 MPH on only 10% of the clips.
Stations chisel off (a small section at a time) the platform edge treatment and markings, replacing it with temporary structure and markings.
The big day: Railroad shut down.
Stations start early because they know the last trains won't use the whole platform. They tear away the temporary work and immediately place the new permanent platform edge. They do this early in the day, to give the epoxy time to cure. Then, they do any in-station work that would be too disruptive to do while the station is open. It finishes the day still a shambles, but a usable one.
Signaling does the big cut-over. The cable is removed from the temporary LED signal head, and run into the old box, where it is spliced to the wires for the proper signal head. At this point, the old signal equipment box is nothing but a cable pass-through.
Track sends through a parade of machines. The first one removes the last 10% of rail clips. The second machine picks up the new left rail, lifts away the old left rail and exchanges them. The third machine does the same with the right rail.
At rail joints (every 1/4 mile), crews bolt up the long rails with traditional track joint bars, drilling and cutting as needed. Trailing machines reinstall some of the track clips, as many as possible but without falling behind the rail change crews. The track now looks exactly the same as the day before, except if you look close, the extra rails are worn out instead of new.
The days after
Track quickly moves to install more and more rail clips, lifting the slow order as it does.
Months after: Mop-up.
Signaling moves from box to box, removing leech circuits and rerouting conduit so the signal head and legacy sensors connect straight to the new boxes. Signaling then strips the equipment out of the old boxes, and wiring out of the old conduits, and removes them.
Stations finish the work in the station, and have their grand opening in March.
Track quickly sends crews to pick up loose clips, bars, bolts and other track material left behind. Within a year, they send the rail train back through to pick up the old rails. Then, they pick up the spacers and straps that kept the rails out of contact with the third rail.
One thing you should notice is, that due to the staggering amount of prep work, the Big Day doesn't necessarily require a large crew. A significant fraction of the day is held back for contingencies, so if nothing goes wrong, crews will get to see their families Christmas evening. They'll be pretty tired, though.