If you want to add an application to the Dock, click the Launchpad icon in the Dock and drag the application icon to the Dock; the icons in the Dock will move aside to make room for the new one. If you want to add a file or folder to the Dock, just drag its icon from any Finder window (or the desktop) and drop it on the Dock. The resulting icon that appears in the Dock is actually an alias of the original item (it's kind of a pointer to your original item). If you drag an application or file onto the Dock, you'll be able to open it anytime by simply clicking its docked icon. If you drag a folder onto the Dock, a Finder window of the folder's contents will display when you click the folder icon in the Dock.

To remove an item from the Dock, drag its icon an inch or more off the Dock and wait a couple seconds, then release; the icon will disappear in a poof of smoke. There are some icons that you can't remove from the Dock, such as the Trash and the Finder.

Don't worry, you aren't permanently removing the item from your computer; you simply got rid of its Dock icon. If you want that item back in the Dock, locate the application, file, or folder in the Finder (or with Spotlight), and drag it back into the Dock.

Tip: You can change where the Dock displays and customize its animation style in Dock preferences. See Customize the Dock.