If somebody says
Haben sie Deutsch in der Schule gelernt? or
Haben Sie Deutsch in der Schule gelernt?.
how I can recognise whether it's you or they?
German Language Stack Exchange is a bilingual question and answer site for speakers of all levels who want to share and increase their knowledge of the German language. It's 100% free, no registration required.
Sign up to join this communityIf somebody says
Haben sie Deutsch in der Schule gelernt? or
Haben Sie Deutsch in der Schule gelernt?.
how I can recognise whether it's you or they?
In the written language, you can check if it is Sie (formal you) with a capitalized S at the beginning or sie (they), whose initial letter is lower case. But I am sure that you did not mean the written language.
In the spoken language, you cannot differentiate them without paying attention to the context. If the speaker talks about you, in this case, he/she means Sie (formal you), otherwise sie (they).
For example, if you are in a holiday and talk to a friend of yours about your family and your friend asks you,
Werden sie auch hierher kommen?
it's clear your friend's referring to your family and not to you.
On the other hand, if your family is on holiday and you talk to a (not close) friend of yours about your family and their holiday, and your friend asks you,
Werden Sie auch dorthin gehen?
it's also clear that your friend's referring to you and not to your family.
In the spoken case you can only tell this from the context. If the context is about many people, then it means "they", otherwise "You".
In the written case: A lower case "sie" indicates "they", an upper case "Sie" indicates "You". But check the context anyway because of possible typing errors.