As I said in my comment, the particle に can be rendered as in, on, at, to or for. It depends on the context which you’ll use.
にある/にいる identify where something (ある) or someone (いる) is. Lest you be confused by my parentheses here ある means is for nonanimate things (hence something); いる means is for living things, not just people (as someone might imply). In either case, ある/いる only mean is in the sense of location in space.
For example, に shows where something is. Here we’re talking about an animate object, a cat.
The cat is in the house.
Here’s an example with an inanimate object, a book.
The book is on the desk.
Let’s look at some of the examples you posted.
I got on the train.
Here に shows what you got on or in to ride someplace.
tobacco is bad for your body
Here に is best rendered as for
In a comment you asked why you couldn’t use が here. First, タバコは体が悪い, just doesn’t make sense. To see this a bit consider omitting talking about tabacco
would be saying
The body is bad
Your next example involved an expression of time.
In time expressions に is usually rendered as at.
I leave the house at six
This just means (literally)
It’s necessary for me.
or (more loosely but depending on context)
It’s important to me.
Your last example is somewhat idiosyncratic from the point of view of English and depending on your familiarity with other languages that have similar constructs, it may or may not come easily to you.
Generally this might be rendered fluently as
Do you need me for anything?
where the for anything is how I’m translating 何か; it has nothing to do with the particle に here. The わたしに part is just translated as me.
But this translation obscures what’s happening in the Japanese because in English this is the most natural way to render this particular type of question.
However a more strictly literal translation might make the grammar of this a bit more clear
Is there some kind of need for me?
Basically what you have here is the idiomatic expression
This is just the standrd way of asking, “is there something I can do for you?”
You can modify this form to express different but related ideas. For example, if you said something like
you be asking “do you have some kind of need (intended use) for this book?”
As you can see, you selected a diverse variety of uses for に. In a Japanese language class, each of these might be handled in separate lessons.