Sure is an adjective. It modifies nouns or pronouns.
Surely is an adverb. It modifies verbs, adjectives, or adverbs.
Correct: It is a sure thing.
(Thing is a noun. An adjective modifies it.)Incorrect: It is sure hot outside.
(Hot is an adjective. It should be modified by an adverb.)Correct: It is surely hot outside.
(Hot is an adjective. An adverb modifies it.)
See also Real or Really?