A lot of it is luck
. But light is important. And that can be tricky when hamsters are asleep in daylight. I’ve had some nice pics taken just on a phone but find the phone doesn’t do well with low light - in terms of picture quality or having enough speed to prevent blurring.
Basically if there’s enough light it gives a faster shutter speed and catches a hamster in seconds without blurring - as they rarely sit still for long.
I used to use a compact camera which had good settings for low light. Normal room light can look a bit warm/yellowy but most modern cameras can adjust for this and rectify it. I don’t have an slr (they give really high quality photos) but I do have a small camera with interchangeable lenses rather than a zoom lens and this allows more light in. Single lenses tend to have a wider aperture (lets more light in and has the background out of focus) than zoom lenses - but my compact camera but not necessarily as my compact camera also had a wide aperture setting.
But basically you first need the hamster out of the cage usually! A good time for photos is during play time when they’re out in a playpen first example and the room is well lit but not so bright it bothers them.
Personally I don’t use flash. It tends not to give great results and startles the hamster and I’m not sure it’s good for them on a regular basis.
If you use a phone camera it will just give the best settings it can for the amount of light. If you use a camera you should be able to see what the settings are. Anything slower than 1/60th of a second speed will blur unless the hamster is sitting still. Anything faster than that and you might be able to freeze action but normally you need them to be still for a few seconds!
I rarely spend much time trying to get a good photo and just take my chances when the hamster is out and these photos are for fun and memories. To have a posed photo partly depends on how the hamster feels at the time. But also needs some preparation - eg putting a blanket on the sofa as a plain backdrop, some items to make the photo fit the theme (eg Christmas baubles if it’s a Christmas photo) and maybe the odd treat in strategic places to help the hamster stay there while you take photos. Although I tend to find I just get the top of the hamster’s head while he’s eating the treat!
If you have another person there they could dangle a treat slightly above them while you take the photo. And then give it to them of course.
I had a nice one of Pickle at Christmas after having him out in the bed with lots of Christmas items set up (he knocked them all over!). And just snapped for about 10 or 15 minutes. Out of umpteen photos I was lucky to get one good one where he sat still and looked up at me with something Christmassy still in sight. Sometimes they do actually “pose” and they get used to it as well.
Just to add - it doesn’t always go to plan but if you can get something sharp and we’ll focused and the hamster is looking the right way it can be special and capture their personality.