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.
In /usr/share/icons/Faenza/index.theme it says (clipped)
[Icon Theme]
Name=Faenza
Inherits=gnome,hicolor
Comment=Icon theme project with tilish style, by Tiheum
Directories=actions/16,animations/16,apps/16,categories/16,devices/16,emblems/16,mimetypes/16,places/16,status/16,stock/16,actions/22,animations/22,apps/22,categories/22,devices/22,emblems/22,mimetypes/22,places/22,status/22,stock/22,actions/24,animations/24,apps/24,categories/24,devices/24,emblems/24,mimetypes/24,places/24,status/24,stock/24,actions/32,animations/32,apps/32,categories/32,devices/32,emblems/32,mimetypes/32,places/32,status/32,stock/32,actions/48,animations/48,apps/48,categories/48,devices/48,emblems/48,mimetypes/48,places/48,status/48,stock/48,actions/scalable,apps/scalable,categories/scalable,devices/scalable,emblems/scalable,mimetypes/scalable,places/scalable,status/scalable,stock/scalable
Notice the 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/gnome/ and /usr/share/icons/hicolor/). You'll find that most (Ubuntu) icon themes inherit from gnome and/or 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.