This last aspect played into one of the most important aspects of fiction writing - dramatic impact. Having decided not to simply ignore the fact that John Spencer had passed away by keeping Leo's character alive but off-screen they then had to decide when to "stage" his death so that it would have maximum impact dramatically. As I've mentioned, too soon and it causes problems with the ongoing story arc, but too late and it doesn't have the impact that such a major event in the history of the show deserves. In a very real sense John Spencer's character was the real leading actor in The West Wing, at least as much as Martin Sheen's President Bartlet, so it needs to have an impact. The show's producers decided that the proper time was the two-part election night episode. The first of the two episodes had Kristin Chenoweth's character Annabeth Schott entering Leo's room and (off-screen of course) discovering his body. The second episode showed the impact on the election, and more personally the immediate impact of Leo's death on those who knew him best: Annabeth, Donna Moss, and most critically Josh Lyman, for whom Leo had been a mentor and almost a surrogate father.
There was at the time no small amount of grumbling from fans about the way the episode in which Leo died was structured. Their belief was that the episode should suddenly devolve into some sort of reminiscence about the character as a tribute to him and to John Spencer. They were angered that the episode went from mourning Leo, to the impact of his death on voters instates where the polls hadn't closed, to partying as favourable results came in. I think it was fitting - a recognition that despite the death of a friend life goes on and in the business that these people are in that this involves celebration and anger. Besides, the second part of "Election Day" was really about Josh Lyman's reaction to his mentor's death at the moment of his personal triumph.
The same fans reacted equally badly to the next episode "Requiem" which featured Leo's funeral and wake (yeah I'm talking about you Alan Sepinwall). I don't know what they were expecting - possibly a clip show of Leo's great moments, an evening full of anecdotes and nothing that advanced the story. Maybe they wanted the cast sitting around and talking about John Spencer. What they got, in my mind was more realistic. The episode was in three parts, funneling down in degrees of intimacy. The funeral at the cathedral was the most inclusive - just about everyone who appeared on the show was there (although I didn't see any sign of Roger Rees as Lord John Marbury - maybe he decided to skip "Gerald's" funeral). It was also the most formal. Next on the level of intimacy was the White House memorial. The group of people at that was necessarily restricted. And, as at just about every funeral I've been to discussion at this event wasn't just about the deceased but about the everyday events in people's lives, including work. The fat that this part wasn't all about Leo irked some people. Finally there was the most intimate gathering of all in the residence. This was family, the extended family of the President and those who were closest to Leo, the people who knew him best - although for whatever reason the writers decided to exclude his long suffering (or long time cause of his suffering) secretary Margaret from this group.
The thing that seemed to come through with the death of Leo McGarry is the attachment that the writers of The West Wing felt for the character and the actor who played him. It was necessary to work the situation into the fabric of the show; John Spencer had been too integral a member of the cast of the show, and Leo too important a character to simply have him disappear in the way that some shows have handled the deaths of actors. At the same time they had to integrate it into the story line without disrupting the story they were trying to tell. In my opinion at least they handled it well. Now the thing that they didn't do - because apparently it would have cost too much - was a show before the finale featuring the show's cast, where I think a lot of the talk would have focused on John Spencer. That would have been a fitting tribute, not for the character but for the man who played him.