Well, remember that the end of Steinbeck's Of Mice and Men is definitely debated among scholars. George's actions are never fully explained; therefore, we are left with some ambiguous questions. Still, it is fairly easy to understand how the ending fits with two of the most prominent themes of the novel: appearance vs. reality, and friendship.
First, let's discuss the last moments of Steinbeck's Of Mice and Men in order to understand what happens at the end. Curley's wife has been murdered (albeit by mistake) and it is Lennie who is the culprit. There is a large group of people out to get Lennie (and lynch him) as a result of this "crime." Lennie runs right to the pool of the Salinas River (which is where he was at the beginning of the novel, actually). George meets up with Lennie there (but not before he grabs a pistol). In an act of loyalty, George asks Lennie to talk yet again about their dream of owning a farm together. As Lennie does the recitation of the dream, George's hand shakes as he pulls the pistol's trigger and shoots Lennie in the head. When the rest of the hands arrive, George says that he took the gun from Lennie and then shot him. George walks off with some of the other ranch hands. Thus ends the book.
Now let's discuss how it fits with the first theme: appearance vs. reality. The appearance (or in this case the true idealism) exists in the dream that Lennie and George have: owning a farm. This isn't real; it is only appearance. The two talk about it, dream about it, drool over it for the entire book. It brings them happiness to discuss this dream. But the reality is very different from the appearance here. Crooks is the first to admit the reality:
Nobody never gets to heaven, and nobody gets no land. It's just in their head. They're all the time talkie' about it, but it's jus' in their head.
In short, at the end of the book the dream is dead, or, at least, the dream of George AND Lennie. George is still living, so he could still have the dream. (This is one of the interesting ambiguities of the ending, for sure!)
The other theme that definitely fits with the ending is the theme of friendship. Although some scholars disagree, I am of the mind that George is loyal to the end and it is out of loyalty that he shoots his handicapped friend, killing him instantly. The theme of friendship is intimately connected to the theme of appearance vs. reality in regard to the dream of the two friends. It is this dream that cements their friendship together and makes them happy. Because of Lennie's accidental killing of Curley's wife, George knows that the dream for Lennie is dead for sure. Lennie will not be able to live the dream. In fact, Lennie will not be able to live at all, and if it weren't for George, would have faced a horrible death by lynching from an angry mob (probably as Lennie didn't understand what was really going on). It is friendship that makes George pull the trigger. The irony is, it is also the theme of friendship that makes George's hand shake violently, feeling the grief at his friend's death.In conclusion, we can say that the ending of Steinbeck's Of Mice and Men definitely connects directly to the themes of appearance vs. reality as well as the friendship theme. Poor George is loyal, but heartbroken at the end. The dream with Lennie is gone. If George is to have the dream of his own farm, he is going to have to do it himself, or with another ranch hand. Why? Because, as a friend to Lennie, the most loyal thing to do was to take Lennie's life quickly as he stood in happiness reciting his dream.