If they refuse to give visa, will they refund my visa fee?
No, if you are refused of the visa your visa fee and the diversity processing fee will not be returned back.
Before you process the lottery after the winning the notification, you will be informed by the authorities about not process the apllication further, if you don't have the required eligibility.
And there are many other reasons that you may get refusal to issued with a visa.
Don't have the required education or work experience.
Didn't enter the spouse and children details in the online entry and entering them in the later application.
Submitting fake documents.
Failing medical Test.
Failing the police clearence
And many other things, which the immigration officer can find out at the time of Interview.