A good GM will play to the strengths of each of the players. Some players like action and fighting, so to please them you have to have some combat encounters or chase scenes. Some players prefer character roleplaying, so give them some interesting NPCs and social situations to interact with in conversations. Some players like investigating and following clues, so give them intriguing snippets of information which they can piece together to deduce what's happening.
And some players enjoy treating the game as a system of rules within which they can try to optimise their outcomes - these are the players for whom you create intricate deathtraps that need to be outfoxed, or puzzles that rely on interaction with game mechanics. (The treasure is on a rock ledge 60 feet away, across a pool of lava. You have 50 feet of rope, a potion of levitation, and a crossbow.) If MacGyver was a gamer, this is the sort he'd be.
Luke: When did you get infected by Nute?
GM: When he downloaded the Peace Moon. I gave Pete a note to explain what Nute would and wouldn't let him do.
R2-D2: I was subtly trying to indicate that something was wrong with me! I tried to abandon the party back on Hoth, remember?
R2-D2: I was totally acting out of character! Don't tell me none of you noticed?
R2-D2: Another thing I could do was swap the Rs and Ls in my speech. I was figuring out how to let everyone know something was wrong, within the parameters of the system.
GM: He had to be subtle about it. For every R/L inversion he devised which none of you noticed, I gave him bonus XP.
R2-D2: It was an intricate puzzle that I had to solve.
GM: And you know the best bit?
R2-D2: How awesomely I did it?
GM: You were roleplaying.