Use Can I have some when you want a portion of something, usually food or drink being shared. Can I have some cake, please? asks for a slice, not the whole cake.
If you want the whole item, name it instead. Can I have a coffee, please? fits a counter, where the whole thing is normal.
At the counter, at home, and at a shop
At a café counter: Can I have some cake, please? You're asking for a slice, not the whole cake. This fits when the thing can be divided and served in an amount.
At a family dinner: Can I have some chicken, please? Same idea. Someone's serving, and you want a portion passed to you.
In a shop selling whole units: Can I have some cakes, please? Here 'some' with the plural means you want several whole cakes, so this works when you genuinely want more than one.
Contrasting case: when the whole item is normal, drop 'some' and name it. Can I have a latte, please? sounds right at the counter, because nobody serves part of a latte.
Whole item or portion: how 'some' changes what you're asking for
If the food can be served in amounts, some is what you want. Say Can I have some cake, please? and the person pictures a slice being cut, because cake comes in portions.
If you want the whole item, don't use some. At a counter, Can I have a cake, please? names one unit, and that's what the seller expects to hand over.
Can I have some cake, please? fits a dinner table where cake's being shared out. Can I have a cake, please? fits a bakery, where you're buying one whole one.
One boundary to keep in mind: the portion reading is established for foods that divide naturally, like cake, chicken or pie. Outside foods like these, you can't always count on some to signal a portion, so it's often clearer to name the amount instead: Can I have a piece of paper?