UPDATE: In iOS 7.0 Rotation Lock has been moved to the Control Center. To access Control Center, swipe up on your Home screen, then tap the padlock icon to enable Rotation Lock.
UPDATE: iOS 4.3 adds a Settings option to turn the mute button back into a rotation lock switch.
UPDATE: Apple has changed the rotation lock switch into a mute button with the iOS 4.2.1 update. To lock the screen orientation double-press the home button to bring up the multitasking dock. Swipe left to right on this dock until you see a gray box icon with a circular arrow inside. Tapping this icon will enable or disable rotation lock. When the orientation is locked a padlock image appears inside the icon.
In some cases the iPad screen will rotate to portrait or landscape orientation when you want it to stay fixed. To lock the screen rotation Apple has designed the iPad with a convenient button located on the side of the iPad.
Click the button on the top right of the iPad, just above the volume controls to toggle the accelerometer lock. This will tell the iPad if you want screen rotation on or off.