The last is the biggest. You need to close track regularly to maintain it, and closing all tracks for 8 hours at night is the easiest for people to figure out.
> first, what do you do with the train during the day when nobody wants a bed (regular trains park at a station overnight and are ready to go the next morning).
Most trains are taken (empty) to a depot for cleaning and maintenance — the schedule is generally planned around this. It's also where the drivers turn up for work, and it's easier to cope with illness etc this way.
A few trains will be left near a station to run the first train(s) towards the depot in the morning.
Nevertheless, I imagine there are places where costs have been cut to the bone, and there aren't spare sidings for a night train.
> Third, how will you maintain the track if there are trains running on it
You plan the night train with sufficient slack in the schedule to take an alternative route. This can also help with the second point.
https://news.ycombinator.com/item?id=25420455 from 7 months ago, etc.
Are they gone? I've gone backpacking in Europe a couple times with a rail pass or tickets in the last ten years, and regularly used overnight trains.