First, make sure the window you want to organize is in front, and go under "View" and select "View Options". You'll see a pane pop up. Then, select "All Windows" if you want the changes you are about to make take effect for all finder windows in icon view. Then, select either "Snap to Grid" or "Keep Arranged by..."
Both of those selections will keep your icons in a grid alignment.