Although they don't look like relatives you'd see in a family portrait, stingrays are actually fish. Like any other fish they breathe through gills, with the aid of one extra interesting biological addition: spiracles.
Differently Similar
With skeletons made of cartilage instead of bone, stingray physiology is a little different than the finned friends we're used to thinking of in the aquatic pet department. Their scales are a modified version of the more familiar fish scales, and their gills -- through which they breathe -- appear as slits on the underside of their bodies.
The eyes of stingrays are on top of their bodies; this adaptation helps them as they live primarily on the sea floor, or on the bottom of aquariums. Next to their eyes -- and often mistaken for them -- are parts of the respiratory system called "spiracles." Like their eyes, spiracles are an adaptation as well; one that allows them to bury in the sand and still breathe.
A Bypass System
Gills in stingrays work just like gills in other fish. The membrane of gills are thin sheets of soft tissue filled -- like our own lungs -- with millions of blood vessels. Because the skin of fish is semi-permeable, when water passes over them oxygen moves from the water into the bloodstream of the stingrays. This is actually similar to how humans breathe air, only our breathing apparatus is on our insides, while in stingrays it's on the outside. Their gills are protected by a sturdy plate made of bone, called an "operculum."
Now while other fish suck in water and push it out through their gills simultaneously, stingrays suck in water through the spiracles on the top of their heads and pass it over the gills as they "exhale" it out of their system. The spiracles are actually an additional set of gills set on their dorsal side. The benefit of breathing in through spiracles and out through gills means that the rays can sit comfortably in their preferred habitat, in the sand and substrate at the bottom of a tank, and watch for food while hiding from predators.
Warnings
Because they spend so much time on the aquarium floor, stingrays require good tank circulation. Be aware of "dead spots," or locations in the tank where water circulation is poor; these can harbor pockets of low water quality.
Ray Responsibility
Don't worry if your stingray has burrowed into the sand on the floor of the aquarium. He'll be able to breathe fine, and most likely will feel the most safe and secure in his chosen spot. You can check on his breathing by watching the movement of his spiracles; consistent breaths indicate his general state.
Rapid breathing or panting is an indication of poor health in a stingray. High levels of ammonia or low levels of oxygen can cause "hypoxia" -- neurological brain damage -- which can lead to organ issues and eventually, death. To prevent hypoxia, keep stingrays in an appropriately-sized aquarium given their size, age and species. Be sure that their dissolved oxygen content is high, especially while moving your rays, and most importantly: Check with your local aquatic specialist or marine veterinarian about their housing, needs and quality of care.