If the program is open, the icon will appear in the dock when it’s running and disappear when you quit it. But if it’s a icon for iCal, iPhoto, Garageband or one of the Apple installed programs that you never use, it’s easy to remove.
Click and hold down the mouse and drag the icon out of the dock to the desktop. You’ll see it disappear in a puff of smoke.
Removing the icon from the Dock doesn’t delete the program, which is good, in case you want to use it in the future. If you want to put the program back in the Dock, find the program in your Applications folder and drag the icon back to the Dock.
To remove an icon on a MacBook with a trackpad, hold down the Option key and click once on the icon to bring up a menu that will give you options to remove the icon.
You can see this same menu with the mouse on a desktop Mac by right clicking or holding down the Option key and clicking. The contextual menu shows other options like Start, Remove from Dock, Open at Login and Show in FInder. And when the program is running, you can elect to Keep in Dock, which means the icon will stay in the Dock when the program isn’t running, so you can easily start it up again.
The Dock itself has options, too. Right click or option click on the row of bars near the Trash can and you will see options for the Dock, including size, magnification, position on screen, etc.