Why did Walter Mity imagine himself facing a firing squad?
Because Walter Mitty is so weak and hen-picked in his real life, he develops a fantasy world in which he is active and many times a hero. Putting himself in front of a firing squad would initially be contradictory to his usual daydreams; however in this particular day dream, he plays the part of a noble hero who is put innocently in front of a firing squad. This may also reflect his feelings about how he feels in his relationship with his wife. She nags him constantly, and he silently endures. It is also significant that his daydream about the firing squad comes right at the end of the real day he is having with his wife. As he is standing on the street, he imagines himself smoking a cigarette bravely facing the firing squad whereas in reality he is standing in the rain waiting for his wife to return from the drugstore. He knows he is likely to get more nagging the minute she returns.
Walter imagines himself facing firing squad for the end of his day dreams because these will be ended by his wife who is going to return from the drugstore. I also think ironically that Walter might think facing his wife is similar to facing his death. I mean Walter might die because of the firing squad and also he could die because of his overbaring and bossy his wife.
Walter imagining he is shot by firing squad symbolizes his exasperation with what, has become for him, an intolerable existence given his alienation and lack of fulfillment.