The examples given are definitely ones in which some is a better choice than any, but I'm not positive the rule they've given you is the most helpful one to go by. For example, I would ask, "Would you like some milk in your coffee?" even if I was almost positive the person I was talking to takes their coffee black.
I think the more consistent way of looking at it would be that with some there's a specific subset you're referring to, while with any there isn't.
Would you like some milk in your coffee?
I probably have a container of milk that I'm offering them, or am prepared to pour some. I'm specifically offering that milk. Alternatively, if I was getting up to go fetch some coffee, and before I leave am trying to determine how "you" would like it, I'd be more likely to word it like this:
Do you want any milk in your coffee?
I don't have any milk. I'm asking if you would like the presence of milk -- any milk -- in your coffee.
[It's only fair to note that I may also use this phrasing in the same situation as the example above, and would be more likely to do so if I'm expecting a negative answer. The rule you found about positive and negative expectations was not wrong, I just don't think it's the most helpful way to think about it.]
This is perhaps a little clearer with your other example sentence...
Didn't you borrow some books of mine?
Did you borrow some books of mine?
There are specific books I have in mind. Perhaps I vaguely remember you asking to borrow some specific titles. Perhaps I'm missing certain volumes from my collection and am wondering if you have them. Compare this to...
Didn't you borrow any books of mine?
Did you borrow any books of mine?
The implication of each question here is slightly different, but in both I'm referring to the entire set of my books. In the first, perhaps I thought you borrowed some books but have realized none of them are missing. Or perhaps you're complaining that you have no books to read and I'm surprised because I thought you took any of mine. In the second, it sounds like I've given you permission to borrow anything from my collection and am just wondering whether or not you've done so.
Alright, so now to get to your actual question:
Yes, you can use the same rules for someone and anyone.
Does someone know the answer?
Does anyone know the answer?
What's the difference here? Honestly, not a lot in this context. I would, however, be more likely to use anyone when posting a question on a public forum such as this one, and asking if there was anyone out there who may be able to help.
Is somebody in there?
Is anybody in there?
There's a clearer difference for this question. When I'm asking if someone is out there, it does sound like I believe there is. Perhaps I heard a noise. Perhaps the door is locked from the inside. Conversely, when I ask if anybody is in there, I don't have an implied expectation. So, your positive expectation rule works here. However, so does my specific subset rule. If I ask for somebody then I'm referring to the person who made that noise I heard, or the person who locked that door from the inside. When I ask for anybody I mean just that -- anybody.
And, finally, I'm far more likely to use anybody if I think the question may apply to multiple people, while I'll use somebody if I only need one person.
Can somebody pass me the rice?
It doesn't matter who passes it, but I only need one person to.
Has anybody seen my keys?
Just because my mom saw them, doesn't mean my dad didn't. Either one, or both, would be able to tell me where to look for my keys.
So, while I said I'd use anyone while posting a question here on ELL, I might use someone if I worded it differently:
Does anyone know the answer?
Can someone show me how to do this?
There are cases where you can jump back and forth or use whichever one appeals to you. However, I think this guideline is a good one to go by. And if you encounter a case where you use it and still aren't sure which word's best then it will usually mean they're both equally acceptable.