Atoms are ranked by their atomic number to see which one have the higher priority. The the molecule will rotate 1-2-3. CW=R CCW=S.
In chiral centers the lowest priority has to be in the back, if not, the configuration is reversed.
In double bonds atoms are direclty attached to each carbon ranked by their atomic number, they can be 1 or 2 if both are on the same side is Z if they are on opposite ends is E.