Use "some" in positive sentences and questions where you expect the answer to be "Yes". For example: He has some good friends. OR: Can I have some apples, please? (You know there are apples for sale).
Use "any" in negative sentences and most questions. For example: He hasn't got any friends. OR: Do you have any apples? (You are not sure if they have apples).