I'm not a lawyer, but I've got some idea about copyright.
Copyright does not cover names, facts, or vague ideas. However, the FR deities are almost certainly not legal for use:
- They are more than a simple concept; complete characters have often been protected under copyright (J.D. Salinger's Holden Caulfield, for example), and there is nothing about the FR deities that does not earn them this protection.
- They are potentially under trademark (I'm entirely unfamiliar with trademark, so I can't help there).
- Fair use primarily (but typically only) applies for commentary, discussion, or educational purposes; writing a story doesn't count.
When I was in class, my copyright law professor used to say (a slightly different version of) the following:
Copying someone's work verbatim without their permission is infringement, unless it is fair use.
While one can argue that you aren't copying someone's work verbatim, that's overlooking the concept of copyright law: copyright law cares more about the essential qualities of a work than its literal format: if I were to copy a book and simply run it through Word's thesaurus to change all the words to a synonym it would still be an illegal copy.
Using D&D content in a third-party work without permission is almost certainly going to be infringement.
With this in mind, you have two ways to continue:
- Change enough stuff to skirt the law.
- Hope Wizards doesn't sue.
The first option requires some significant changes, but not as many as you'd think. Since you probably don't deal too much with the histories of the deities involved, name changes may actually be sufficient for legal protection.
The second option is bad, but if you're writing an entirely non-commercial fan work, you may be able to let it skirt by. If you hope to sell your work, however, you will likely be sued, while a non-commercial use will typically see a cease and desist notice (again, this is not a legal opinion or advice, just a commentary on the way things are; if you get sued you're on your own) instead of a lawsuit because copyright law is expensive to enforce.