No, I'm not talking about the hangnail on your big toe, I'm talking about your beer.
Nearly every new homebrewer I've ever talked with thinks their first beer is infected. They taste their beer after it's been fermenting a few days, it tastes a little weird to them because they've never tasted such young beer before, and immediately assume something has gone wrong.
I think this fear is perpetrated, in large part, by experienced homebrewers stressing the importance of cleaning and proper sanitation. New homebrewers read about the horrors of failing to properly sanitize, and see all the ways the beer can go wrong, and assume that because they've never done this before, they've screwed something up and it's infected.
The truth is, it's actually pretty difficult to unintentionally infect your beer. Yeast doesn't play very nicely with other microbes. It eats all the good food and then poisons its environment by giving off alcohol as a waste product, and you're throwing massive amounts of yeast into your wort. Very few microbes can amicably survive alongside yeast, and those microbes, while they may make the beer taste funky, can't hurt you.
How can you tell if your beer is actually infected?
One of the easiest ways is to taste the beer, but this doesn't work very well if you're a new brewer. New homebrewers don't actually know what young beer should taste like, and chances are they've underpitched their yeast, haven't properly aerated, and possibly did a poor job of cooling the wort, all of which will give their beer off flavors, but don't mean their beer is infected.
Another way is to look at the beer in the fermenter. Does it have a thick, white or tan, frothy head? That's a good thing, probably not infected (a thin head is fine too.) Does it have what looks like huge soap bubbles that have been sitting there for days? OK, that might mean it's infected. Does it have a very thin, milky looking skin over the top? Yeah, that's probably infected.
Another great way to tell whether or not it's infected is to take gravity readings. Has the gravity stopped dropping? Is it reasonably close to where you expected your final gravity to be? Then it's probably not infected. If your final gravity is significantly lower than you expected it to be, you might have an infection. If your final gravity is significantly higher than you expected, you probably just messed something else up, but don't have an infection (and the beer will be fine, just a little sweeter than you'd planned on it being.)
If you think you have an infection, take a picture and show a more experienced homebrewer. They'll likely be more than happy to assure you whether or not you have an infection (although, even experienced homebrewers don't know everything, I actually ended up taking a picture of one of my recent beers and asked people whether or not they thought it was infected because, while it didn't really look infected to me, it looked pretty weird. I'm still pretty sure it's not infected.)
Another great way to go is, once you're sure it's done fermenting and the gravity isn't going any lower, even if you think it's infected, go ahead and bottle the beer and let it bottle condition for a while. Some infections can actually lend an interesting character to the beer.
If you do bottle an infected beer, you might want to put it in a closed box of some sort in case you accidentally end up with bottle bombs though, and if you open a bottle and it starts gushing everywhere, you might want to think about opening the rest of the bottles to at least let the excess CO2 out so you don't end up with bottle bombs.