Getting the best shots can be very difficult but just a few silmple tips should get you at least half decent shots
First off a good camera is always best, something that allows you to adjust shutter speed and apature but a lot of compacts allow you to do this these days so you dont have to spend hundreds on it
A fast shutter speed will get the least blurry photos (1/2000 is a good place to start)
Lots of light! With a high shutter speed you will need a lot of light to stop you getting dark photos. Usually a large window with lots of sunlight shinning through is perfect, even more so if your hammy is on a reflective surface such as inside a white bath - but sometimes there isn't enough sunlight so using the cameras in-built flash will often freeze a hammy mid action and it also means you can use a high shutter speed.
Finally, its been said before just take a ton of shots and keep the best. There isn't a single professional photographer out there that just takes one perfect shot, you take an average of 10-30 per sequence and keep 2/3 favourites
The rest is just down to timing and luck