In order to avoid feedback, you must follow these four steps:
1) Don't point the microphone at the speaker.
2) Keep the microphone pointing at the source of the sound, which is either your mouth or an instrument.
3) Don't hold your hand over the wind screen part of the microphone, or it will do weird things.
4) Keep things at a reasonable volume.