Gods grant spells to clerics. The rules define them as unambiguous and making their presence known in a default setting.
The rules vary a lot here depending on edition and source.
In 5e the PH section on clerics talks about gods granting clerics spells, but the pantheon section has cleric domains for non-theistic religions and the DMG talks about the rules not caring.
Not all settings are like this, for example, Dark Sun where there is no proof of divinity at all. But even in a setting like Eberron that is closed off due to the Ring of Siberys, it is known the gods grant spells.
Dark Sun has no gods but it does have elemental clerics and their own druids so there is that.
My understanding of Eberron is that it is believed by some that gods grant spells but that it is specifically not defined whether gods do or not, or whether they even exist or not. Eberron also explicitly has the divinely powered clerics of the Blood of Vol philosophy and non-theistic ancestor worshiping elves, and other non-theistic clerics.
Back in AD&D 2nd there were Detect Evil, Detect Good and Know Alignment spells. My cleric ended up working out that there was universal absolutes because regardless whom a cleric worshiped those always came out the same, even for evil clerics.
Given the ambiguous terms that detect evil gave you (degree of evil, possibly the general nature), other than on the yes no of qualifies as evil or not under the spell for a few defined subjects, it was fairly difficult for a DM to be consistently the same.
Detect Evil
(Divination)
Reversible
Sphere: All
Range: 0 Components: V, S, M
Duration: 1 turn + 5 rds./level Casting Time: 1 rd.
Area of Effect: 10 ft. × 120 yds. Saving Throw: None
This spell discovers emanations of evil, or of good in the case of
the reverse spell, from any creature, object, or area. Character alignment,
however, is revealed only under unusual circumstances: characters
who are strongly aligned, who do not stray from their faith, and
who are of at least 9th level might radiate good or evil if intent upon
appropriate actions. Powerful monsters, such as rakshasas or ki-rin,
send forth emanations of evil or good, even if polymorphed. Aligned
undead radiate evil, for it is this power and negative force that enable
them to continue existing. An evilly cursed object or unholy water
radiates evil, but a hidden trap or an unintelligent viper does not.
The degree of evil (dim, faint, moderate, strong, or overwhelming)
and possibly its general nature (expectant, malignant, gloating,
etc.) can be noted. If the evil is overwhelming, the priest has a 10%
chance per level of detecting its general bent (lawful, neutral, or
chaotic). The duration of a detect evil (or detect good) spell is one
turn plus five rounds per level of the priest. Thus, a 1st-level priest
can cast a spell with a 15-round duration, a 2nd-level priest can cast
a spell with a 20-round duration, etc. The spell has a path of detection
10 feet wide in the direction the priest is facing. The priest must
concentrate—stop, have quiet, and intently seek to detect the aura—
for at least one round to receive a reading.
The spell requires the use of the priest’s holy symbol as its material
component, with the priest holding it before him.
Know alignment was fairly straightforward for establishing alignment is determinable.
The rules act as the laws of reality the setting works under.
Sure but there are a lot of options on rules.