Correct use of Surely

Surely does not mean the same as certainly.
Surely is used to say that the speaker believes something in spite of reasons to believe the opposite.
Compare:

That is certainly a plain-clothes policeman. (= I know that is a plain-clothes policeman.)
Surely that is a plain-clothes policeman? (= He does look like a plain-clothes policeman and I find it very surprising.)

They are certainly coming. (= I know they are coming.)

Surely they are coming? (= It looks like they are coming and I can’t believe it.)

Note that sentences with surely often have question marks.

Surely you are quitting? I thought you would continue. (= I can’t believe that you are quitting.)

Surely that’s Peter over there? I thought he was in Switzerland.

When used with heavy stress, surely suggests that the speaker would like to believe something, but is beginning to lose hope.

Surely she is going to get a job? (= I would like to believe that she will get a job, but it looks like she will never.)

Surely there is somebody in the house? Why don’t they answer the phone?

Surely not is used to express difficulty in believing something.

Surely you are not quitting that job? (= I can’t believe that you are quitting that job.)
Surely you are not going out in that coat? (= I can’t believe that you are going out in that coat.)

American English
In American English, surely is used in replies to mean ‘certainly’.

Could you lend me some money? Surely.
Do you want something to eat? I surely do.

The results are surely encouraging.