Dear Rabbi I was wondering, about hebrew names. Why on some occasions we refer to a someone as the son/daughter of his father and sometimes son/daughter of his mother?
ב"ה Shalom The main reason for mentioning the name of the mother when praying for the sick, is based on the Zohar (פ' לך לך דף פ"ד ע"א) which emphasizes that David Hamelech in Tehillim (פו:טז) who turns to Hashem and says "Save the son of your maidservant" which refers to his mother. The Ben Ish Chai(בן יהוידע ברכות נה:) mentions that a mother has less faults since she is not accountable for not fulfilling certain mitzvoth which are time related and also not required to study Torah like a man. Therefore ,her merit is sought when praying for the sick.(See also at length שו"ת יביע אומר חלק ב - אורח חיים סימן יא) However, when it comes to issues of lineage, such as an aliya or giving the name to a child the custom is to use the father's name. All the best