For a whole bunch of different reasons! Challenge and diversity mostly, but there are other reasons I've played online as well. Playing with friends for example is always fun, often regardless of the game in question even.
Recently I've been playing a fair bit of Tribes: Ascend, but in the past I've gotten pretty into a whole array of different online modes. Starcraft 2 (Platinum league, for what little that's worth), Dawn of War 2, Battlefield 2, Left 4 Dead, Bad Company 2, Company of Heroes (Probably my favourite online rts), SWAT 4, and a few others. Playing online in those games just offered an experience the singleplayer couldn't replicate. Left 4 Dead is damned boring without friends yelling over their mic for example, and you'd see people pulling all sorts of clever tricks and strategy in the various rts that the AI would just never know to do.
Then there's MMO. I used to play WOW for the longest time and I've also dabbled in other mmo from Age of Conan to EVE and Guild Wars. Those I largely play for completely different reasons than the games above; I play MMO to explore, to see the vast environments and to interact with both the NPC and players alike inhabiting that world. It's why WOW was so good at the time, the world was massive and incredibly detailed. Helped that a good number of my friends played as well.
Eventually however players quit and I ran out of new things to explore so WOW fell by the side. Just nothing left to do there, I don't care about the competitive pvp aspects nor the raiding. Ah well!