AppleID is used for many things.
If you meant for purchasing through stores, yes you can easily log out an account to log back with another one to do purchased. This will mean that you will have to authorized your computer with the account used for purchased and you can use one ID on up to 5 devices.
If you meant for iCloud, you shouldn't have to (or will have to explain a little bit more your intent). AppleID should be used by only one person. If you are multiple to use the iMac, you should create session for each users and then yes, each user login in their respective session can configure it with their ID.
No, you cannot "easily log out an account to log back with another one". There is a 90 day period where you cannot associate a computer with an apple id. If you associate account 1, sign out, associate account 2, you cannot associate account 1 for 90 days.