That's a really complicated question if you want every single of these discussed with examples
Long story short, -нибудь refers to a hypothetical object: you have an idea that something might fit your description, but maybe such object does not exist at all. If it exists, it does not quite matter, which one. Кто-нибудь and что-нибудь may also refer to a choice from a set of known objects when it does not matter which one is chosen.
-то refers to a real but unidentified object. It is a certain object, but you do not know what it is.
This makes them not interchangeable in some contexts.
Past
In questions, assumptions and suggestions about the past it is OK to use кто-нибудь and что-нибудь. In statements, you cannot use them in the past. After all, if you are sure the event happened, then its participants are real—even if you do not know them:
- Question: Кто-нибудь из вас раньше здесь был?
- Assumption: Если бы кто-нибудь тут был, он бы тебя увидел. = If anyone were here, they would see you.
- Assumption: Тебя мог кто-нибудь увидеть.= Someone might have seen you (кто-то is also possible)
- Statement: Тут кто-то был. = Someone was here.
- Statement: Начальник что-то тебе принёс. = The boss brought something for you.
Future
In the future "кто-нибудь" is used more freely that "кто-то", because most "something/someone" sentences about future are suggestions, anyway:
- Кто-нибудь всё узнает и расскажет остальным. = Someone will find out everything and will tell the others.
"Some time"
"Когда" is time-related by itself, so its suffixed versions are quite different in usage.
когда-то is typically used in the past to refer to some distant times in the past, "once".
когда-нибудь is either used for the past ("ever") or for indefinite future ("some day"). If you are absolutely sure an event is bounf to happen, you can use "когда-то", too:
- Он точно когда-то/когда-нибудь попадётся. = He is sure to get caught some day.
There exist a few additional meanings for a few of them:
как-нибудь may be used colloquially to refer to "someday, when you have time" etc.—for example, when inviting someone to hang out with you.
где-то is often used colloquially as "about, approximately", even though such usage is not acceptable for formal writing.