Formal:
* À quoi pensez-vous ? (Formal, literally translates to "What are you thinking about?")
* Qu'est-ce qui vous vient à l'esprit ? (Formal, literally translates to "What comes to your mind?")
Informal:
* À quoi tu penses ? (Informal, literally translates to "What are you thinking about?")
* Tu penses à quoi ? (Informal, literally translates to "You are thinking about what?")
* Qu'est-ce qui te trotte dans la tête ? (Informal, literally translates to "What's going through your head?")
More specific:
* Tu penses à quelqu'un ? (Are you thinking about someone?)
* Tu penses à quelque chose en particulier ? (Are you thinking about something specific?)
The best way to choose the right phrase depends on the situation and your relationship with the person you are speaking to.