Increase or decrease the difficulty class of the encounter
The DMG provides this guidance on adjusting encounters on page 85:
Increase the difficulty of the encounter by one step from easy to medium, for example) if the characters have a drawback that their enemies don't. Reduce the difficulty by one step if the characters have a benefit that their enemies don't. Any additional benefit or drawback pushes the encounter one step in the appropriate diection. If the characters have both a benefit and a drawback, the two cancel each other out.
Situational drawbacks include the following:
- the whole party is surprised, and the enemy isn't.
Situational benefits are similar to drawbacks except that they benefit the characters instead of the enemy.
So according to the DMG, you determine the normal XP budget for the encounter, and the move its deadlyness and with that its value up or down one difficulty step, depending on if the characters are surprised, or if they surprise their opponents.
Converting back to XP
The DMG does not provide explicit guidance on how to convert that back to XP to award. You can look at the table on page 85 that determines at which XP value an encounter classifies. For example, for four first level characters an encounter classifies as medium when it has a budget of 4 x 50 XP, and has hard if it has a budget of 4 x 75 XP. If your encounter is falls into the medium tier, but has surprise, you would award a minimum of a hard encounter value or 300 XP here. (Or you could use the ratio, here mutliply the XP by 1.5).
What if it is already Deadly?
One question is what to do if the encounter is already at the extreme, for example it is Deadly, and the characters are surprised. The DMG does not have explicit guidance for that.
For Easy encounters where the PCs also have the benefit of surprise, it means the encounter is posing so little risk and consumes so little resources, that it either is not worth to bother with XP, just like some monsters give 0 XP because they do not really provide a meaningful challenge, or if that feels too stingy, you can use the same step as from Easy to Medium, and award half the amount of XP.
For deadly encounters it means that it is quite dangerous to put up such an encounter as there is already risk of a character dying before that. My experience is that you can push encounters to be quite a bit more dangerous than what the "Deadly" category indicates before the risk of a total party kill or the likelihood of someone dying is very high, but if you are just starting as a DM, it might be better to not experiment with that and avoid setting up encounters that would be deadly by themselves and have guaranteed surprise.
Keep in mind that all the monsters abilities are included in their challenge rating. So for monsters that normally will have surprise, because that is just how they work (for example a Piercer, Roper or Mimic), I would not award extra XP beyond those indicated by their CR. A Piercer for example poses next to no challenge, if the party becomes aware of it before it drops. A mimic is so slow moving that the party will have an easy time killing it without risk using cantrips and ranged weapons, if it does not surprise them.
In practice, CRs are not very exact, and as a consequence neither is the encounter XP math. Many DMs ignore the multipliers for multiple opponents as well as this rule, because it just creates a lot of administrative overhead for little improvement in how the game plays. You also can see the margin of error from the fact that an encounter with both 3 and with 6 monsters (i.e. twice as many) has the same multiplier. So my recommendation is to not spend too much time on these calculations. It won't make a huge difference if you just award the normal XP for an encounter, wether the PCs are surprised, or surprise the monsters, or not, and it is a lot simpler to do.