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