Short history based on a somewhat superficial understanding.
WW2 meant (as to a certain extent happening in the US) there was great demand on the 4 UK railway companies (GWR, LMS, SR, LNER)* to support the war effort, plus the additional issue of suffering damage from bombing that was likely patched together quickly.
Contributing factor, with the end of WW2 the UK was a "victor" and so didn't get US aid in rebuilding, which meant money was in short supply and this had numerous side effects.
So in essence the big 4 were bankrupt with significant amounts of capital expenditures necessary to rebuild the system and thanks to the costs of the war the UK government couldn't afford to pay some (all?) of the deferred railway costs from the war.
In 1947 the big 4 were nationalized and British Railways, later rebranded as British Rail, was born.
The first couple of decades weren't great as a variety of factors contributed to a decline in both freight and passengers including the building of the road and motorway system, the move to trucks for freight and eventually the growing popularity of the car for families.
For those unaware, there was a phenomena known as Summer Saturdays where the railways moved large numbers of people to the coastal resorts for a week of holidays. Traffic was so heavy moving people to Devon and Cornwall and other coastal areas that the GWR had trains backed up across entire counties. But by the 60s this traffic was rapidly moving to cars, and the loss of that as well as the presumed loss of traffic as people had cars the rest of the year meant a large drop in passenger numbers and eventually the Beeching Report, which saw the closure of a big part of the network given the losses those lines were suffering.
In part due to the foreign currency issues the government faced BR was late at dieselization (the UK mined its own coal, diesel had to be imported) with diesels not appearing in any number until the early 60s. This could have also had a negative impact on passenger numbers as the steam at that point would have been considered old and dirty.
The modernization plan (as dieselization was called) was handled badly by the government which resulted in a lot of diesels ordered before they were proven in service, and then a resulting early retirement as many were found to be too unreliable as well as having no use given the type of service they were bought for disappeared either before the arrived or shortly after.
Things didn't start to turn around for BR until the 80s, although part of the success in bringing people back to the railway can be traced to the 70s and the design of the HST (IC125) which became the workhorse of the Intercity division of BR in the 80 and 90s and is even now just finally being replaced in the privatized railway (by the Hitachi class 80x series).
In the 80s BR underwent a serious reorganization (called Sectorization) which resulted in Scotrail, Intercity, Regional Railways, NSE (Network Southeast) and various freight departments all being created to provide both a more focused approach to customers as well as allowing a more clear accounting of costs. This was accompanied by another round of capital improvements funded by the government (electrification of the east coast mainline, delivery of the Pacers and Sprinter DMU's (although at a cost of 2 coaches replacing 3), the IC225 (class 91/Mk4 coaches) and other items. This was a success with a significant increase in customers and at least 1 clever TV ad
https://www.youtube.com/watch?v=iN7naLLeB0A
The recession of the early 90s caused a reversal, but passenger numbers starting climbing again as the economy rebounded and were increasing for about 18 months prior to privatization started.
The other factor influencing things was the election of the Conservative government under PM Thatcher, whose big push was to privatize most of the numerous companies that the UK government had acquired over the decades though she notably did not include BR in that process.
Adding in deregulation of a number of things and the rise of London as a financial capital was put into motion and while the mining and manufacturing parts of the UK suffered London didn't. This become more important as time goes on.
PM Thatcher was ousted by her own party, replaced by John Major, who as PM made the decision to privatize BR.
This is where things get a bit fuzzy, as some like to attribute the rise in passengers to the privatization. Unfortunately for that argument it ignores that passengers numbers were going up prior to privatization, as well as during the 3 year transition period where parts of the system were private and parts were still operated by BR. Even once a section of BR was sold off, the TOC (Train Operating Company, aka franchise holder) still operating much as BR had for another 5 years or more as it took that long to actually implement any changes given the lead times for rolling stock purchases and infrastructure improvements. For example, Virgin Trains operating the west coast line came into existence in 1997 but didn't' have all its new trains until 2002.
Similarly, the London boom and some rejuvenation in the North of England meant commuting was becoming a nightmare as the road system simply couldn't cope, particularly as rising property prices led to longer and longer commutes. Add in the congestion charge in London, big investments local London transit, and there was a shift to commuting by rail that would likely have happened regardless of who was running the trains.
The one thing that can likely be attributed to privatization is the increased continual funding of the rail network, as the private operators would have the ability through their franchise agreements to force continued funding on a multi-year basis, something BR couldn't do.
One final observation. Much is made of the fact that the UK has a private rail system, and this really isn't true. Network Rail, which maintains the infrastructure, is government owned (after the privatized Railtrack failed). Furthermore, at this point in time the franchises are so specified by the government - the number of trains, the schedules, type of trains, etc. - that one can really argue the franchises are a window dressing given there isn't really much ability for a TOC to do much.
* amusingly GWR, SR, and as of today LNER all exist as franchises, although LNER is government run given the failure of Virgin East Coast