I do all three (adding another option!), depending on what's going on.
I normally dryhop in the fermenter, about 5 days before packaging. I don't rack to secondary just to dryhop, but sometimes I have some yeast in the fermenter that I want to reuse so I will rack into the carboy on the dryhops so I can rinse and save the yeast.
Sometimes, I just dryhop in the keg. That works well too, as long as I use a fine mesh bag so I don't clog up my diptube.