You don't say what kind of system you are dealing with, but whether it is Linux or Solaris or whatever, the answer is basically similar.
The most effective way of dealing with a forgotten root password (and please do take White Rider's suggestion of not normally logging in as root) is to boot from a cd (live cd or installation cd) and then from a shell, you mount the HD / partition, navigate to /mnt/etc (or whereever you mounted it), back up your shadow file (just in case) with "cp shadow shadow.bak", then edit shadow, removing the characters between the first and second colons ( : ) so that the "root" line begins with
root::
DO NOT REMOVE ANYTHING ELSE!
Sorry to shout, but that's very important. You could seriously mess up your system. (Of course, that's why I told you to make a backup first).
Now you should be able to reboot, log in as root and set your password. Then don't forget it! After that, make sure to log in as a normal user most of the time and su to root only when you specifically need it.
HTH,
Paul