Hamsters are rodents, and most rodents make chirping or squeaking noises of some sort. The reasons for these sounds are a little more challenging to figure out, but in hamsters they're often a sign of distress.
A single small chirp or squeak is believed to be your hamster's way of communicating with his friends. However, even hamsters kept alone sometimes make this little sound -- so he might be just trying to greet you.
If your hamster starts squealing loudly when you try to pick him up, he's telling you he's scared. Don't worry though, hamsters can't bite while squealing. The best way to handle this is to gently scoop him up, and hold him calmly in your hands until he stops making noise. Repeat this process daily until your hamster calms down and accepts being picked up without screaming first.
If your hamster doesn't calm down with gentle petting, he may be especially anxious or just not feeling well. Put him back in his cage to avoid undue stress.
Squeaks that fall somewhere between a single chirp and a sustained squeal usually signify agitation or aggression. Your hamster might squeak a lot when you first bring him home, as he gets used to his new environment. If he's a dwarf hamster, he could squeak while fighting with his cage mate. It's a sign that he's trying to be dominant. In both cases, he likely will settle down and stop making noise once he gets more comfortable with the situation.
During a fight, the hamster on the bottom -- the loser of the altercation -- will stop squeaking to admit defeat, which ends the struggle. Remove any toys or shelters in the cage where one hamster can trap another -- hiding places need to have two exits. The scuffles usually will diminish over time. If they don't, you might have to separate your pets.