Surely does not mean the same as certainly. There is usually a difference.
- That is certainly Jane’s boyfriend. (= I know that is Jane’s boyfriend.)
- Surely that is Jane’s boyfriend? (That really seems to be Jane’s boyfriend. How surprising!)
Sentences with surely often have question marks. They are used to say that the speaker believes something in spite reasons to believe the opposite.
- Surely that is James over there? I thought he was in Germany.
Surely not expresses difficulty in believing something.
- Surely he is not going to divorce his wife? (= I can’t believe that he is going to divorce his wife.)
In American English, surely can mean certainly in replies.
- ‘Could you help me?’ ‘Surely / certainly.’