I don't understand the meaning of 'ci' when a person say: "Che ci fai qui?". It seems redundant the use of 'ci' and then the use of 'qui'.
In this sentence, "ci" has the meaning of "in questo luogo" or "qui". It is used in a pleonastic way because the sentence in your question contains a "dislocazione a destra", a construction typical of oral speech which is explained in detail in this answer.
Your sentence has indeed a similar structure to this example
Non ci sono andato, a Venezia
given in the book Grammatica dell'italiano adulto by Vittorio Coletti: there is a place complement ("a Venezia" in Coletti's example, "qui" in your sentence) that goes after a complete clause and which is anticipated in this clause by particle "ci". Another example with the same phenomenon is explained in the answers to this question.