The ceramic tiles used on bathroom and kitchen walls are tough but occasionally one will come loosed or even break. In either case, replacement is easy.
If the tile is only loose, you're in luck. Pry it free with a screwdriver, chisel or narrow putty knife. Don't force things or you may chip the loose tile or one of its neighbors. When you get the tile off the wall, chip or scrape away any mastic or mortar on its back and any grout sticking to its edges. Now the tile is ready to got back in place.
If the tile is broken, you can:
Glue it back together with clear epoxy glue. If the tile is only broken into a few pieces and the glazing hasn't been chipped, this should be almost invisible.
Take the scrap to a tile shop and look for a tile to match. Many shops keep a "junk box" full of spares for just this purpose. If you can't find a perfect match, take one that's close, then remove a tile from an inconspicuous part of your wall, put it where the broken tile come from and put near-match in inconspicuous spot.
Forget about trying to match. Use a contrasting tile, or a picture tile. These come in singles, and in pairs or fours that go together to make up a picture or design. If you find one you like you can chip out the required number of sound tiles around the broken one. Then install the pictures tile.
First make sure the wall where the tile will go in smooth and even. You may have to fill chipped-out spots with patching plaster, or scrape away loose mastic or mortar. If you do any patching, let the plaster set fully. Then mastic the tile in place.
Apply mastic to the back of the tile, by don't use too much or it will ooze out around the tile. Leave half an inch around the edge of the tile free of mastic to avoid ooze.
Press the tile down flush with its neighbors. It should have little bumps on its edges to hold it the proper distance from surrounding tiles. If not, use toothpicks between the repair tile and its neighbors to center it in its hole.
After the mastic sets, fill the seam around the tile with grout. Both grout and tile mastic are sold at hardware stores and tile shops. Mix the grout to a paste and force it into the spaces around the tile. After about 15 minutes wipe off any excess with a damp cloth. If there is any mastic on the faces of the tiles, wipe it away with paint remover or laquer thinner.