Declaratory relief occurs when two parties go to court to get clarification. In other words, the plaintiff isn't suing the defendant or trying to recover any money or damages. The two people involved in the case simply want the court's opinion.
There are many situations in which declaratory relief might be sought. Most commonly, it is sought in a contract law case. Contracts are legally binding promises that the court will enforce by penalty of law. The court enforces the contract by requiring a party who breaches it, or breaks his promise, to pay damages.
Sometimes, the two parties to a contract may disagree over what a contract requires or of the meaning of the contract. One party may believe he is obligated to do a particular thing a certain way, while the other party believes something different. The two people may not be able to settle the dispute themselves.
In such cases, seeking declaratory relief would be appropriate. Neither party may want to take the risk of not performing up to par and thus being sued for breach of contract. So, the two can go to court and have the court interpret the contract and let them know what their respective obligations are. Neither party gets any monetary damage or award — the court just tells them that "this" is how it would interpret the contract if a breach occurred, so the parties can then govern their behavior on the basis of that court interpretation.
Declaratory relief is also sought commonly in cases where there is a dispute in regards to whether an insurance policy provides a given type of coverage or not. For example, a policy may contain an exclusion for "unnatural events" but the policy may not fully and clearly define unnatural events. If a claim is made and it is not clear whether the court would require the insurance company to cover the damages or not, the insurance company or the insured can go to court and request declaratory relief to find out how the court would rule. This can govern their behavior before someone does something wrong and a lawsuit — with potential damages — arises.
The concept of seeking such relief from the court is beneficial to both parties. Litigation is expensive and both sides incur legal fees and loss of time. It is generally far better to have the court explain what would happen if the situation arose and a lawsuit was brought than to behave improperly and find out after the fact that the court won't take your side.