In Italy when you want to enter inside the house of a stranger or also of a friend you knock at the door and say, "Permesso?" meaning, "Can I enter?" or "Do I have the permission to enter in your house?" It is very mandatory to say that. Formally if you enter a house without the permission you are committing a crime, so in Italy you must say, "Permesso?" even if a lot of people don't wait for the answer. What is the equivalent of this in English?
You would say this:
May I come in?
Or, more informally:
Can I come in?
However, proper etiquette would have your friend ask you to come in, by saying, for example, do come in, or please, come in, or something like that. If he does not ask you to come in, you should normally assume that he is busy and cannot receive you.
If the door is open, he steps back, and it is clear from context that he wants you to come in, you should take this as permission and just follow him inside. If you don't know him well and are in doubt, that is when you could ask, may I come in? As an alternative, you could just stay put, and he'd ask you in eventually, after an embarrassing moment—or not.
If he just says thank you for dropping by, you may assume he has no time to receive you, and you should shake hands and leave. You should never enter his house unless you'd been given some clear enough signal of permission. Clarity depends on context.
There is no single expression that you "must say", and door greetings will vary widely by region. You will mostly discover that the host invites you in if they find you on their doorstep. Presuming they know you that is! If they don't know you they are more likely to ask your business and you must explain it on the porch until they feel like it's ok to invite you in. You cannot invite yourself in until there is a significant amount of trust, and even then it should be the host's responsibility to initiate.
However rare it will be that you need to invite yourself into a home, there may be cases --say you dropped by the neighbors where you are welcome but usually you are there just to say something quick and run off however this time you want to stay and talk-- in which you need to hint at your desire. In such cases you could get away with something simple like:
May I come in?
But a less direct approach that allows them to invite you in might be better:
Do you have a few minutes?
Il grado di formalità del tuo saluto dovrebbe essere proporzionale al grado di formalità del vostro rapporto con il residente.
The degree of formality of your greeting should be proportional to the degree of formality of your relationship with the resident.
In the suburban US:
1) Knock or ring the doorbell.
2) Greet the resident of the home. ("Hi", "Hello")
3) Explain who you are (your name) and your reason for being there.
4) If you wish to enter, ask the resident. ("Can/May I come in?") Note that entering might not be necessary, depending on your conversation or your reason for being there.
At any point, the resident may invite you inside the home. If the resident invites you inside at the doorway, it is redundant and uncustomary to ask for permission (because the offer of invitation means you already have permission). If you are very friendly with the resident, they might allow you to enter anytime unannounced as long as they are inside the home first. However, this is very rare. It is customary to at least knock.
Some good US examples are found in the TV show "Seinfeld". Sometimes, the characters knock. Sometimes, they use the intercom outside the building. Sometimes, they enter unannounced when the resident is there. Sometimes, the resident invites a visitor inside. Sometimes, the resident talks with the visitor at the doorway. Sometimes, they talk through the door with the door closed.
In AmE/culture, you, who are are trying to enter the home, aren't expected to say anything first, but at most to respond to the homeowner that is expected to say something (no particular thing) to allow you to come in, something like 'Please come in.' The response might be 'Thanks', or just a general greeting. If the homeowner doesn't say anything, you probably want to say something, again no set phrase, just something like 'Can I come in?' or 'Anybody home?' (presuming you don't see anyone).
This is all assuming that you are an uncommon visitor to another home. If you are well-known to the household, it may be acceptable to just walk in without saying anything more than some kind of greeting.
In other words, it is not mandatory to say any particular set phrase, though of course it would be strange to come in silently, without some recognition by somebody at home.