It follows regular icon naming, which will, as far as I know, start at your theme and then keep falling back till it matches something with the name.
Taking for example the Faenza icon theme I currently use.
/usr/share/icons/Faenza/index.theme it says (clipped)
Comment=Icon theme project with tilish style, by Tiheum
Inherits=... line? Those are Faenza's "fallbacks" in case it doesn't have the icon itself.
This is relevant to your question, because you can enter a name for an icon and then the icon will first be searched for in
/usr/share/icons/YOURICONTHEME/. In the odd case that it doesn't find it, it will check the fallbacks (in this case
/usr/share/icons/hicolor/). You'll find that most (Ubuntu) icon themes inherit from
hicolor so if you use the name of an icon in these folders, you can most likely rest assured that every theme will show an icon.