I'm sorry for how long this answer is. But your question is a deep one and I wanted to take it seriously.
Mathematics operates very differently from empirical sciences like physics and chemistry. Sciences take finite collections of observations and try to guess the general law that produced them. For example, based on what I know about chemical elements, can I predict the properties of element 118? Will it be inert? Will it be radioactive? Then I answer these questions by getting hold of an atom of element 118 and observing its actual behavior. This is what seems to be behind your question about how we can be sure that a sequence is linear.
But mathematics mostly doesn't work this way. An atom of element 118 is a real object with observable properties in the real world. A sequence is nothing at all like this. We cannot use any scientific instrument like a Geiger counter to find out if a sequence is linear.
Mathematics has a completely different approach. Mathematical objects are abstract, defined by their abstract properties.
The goal of mathematics is to understand the relationship between different abstract properties.
This is why mathematics is able to deal with infinite objects such as infinite sequences, infinite sets like the set of odd integers, or the infinite lines and planes of geometry. These objects can't be represented explicitly. Instead they are handled abstractly and descriptively. We can make a mark on a piece of paper to help us think about lines in the plane, but papers are not mathematical planes and marks on papers are not mathematical lines. Mathematical objects are not drawings, they are descriptions of properties.
Suppose someone hands us a list of numbers and asks “Is this sequence linear?”:
$$ 1, 3, 5, 7, 9, \dots $$
We can't really answer, because this is not a sequence. It's just a list of numbers with three dots written at the end.
We might guess that this person meant to ask if the sequence of positive odd integers was linear. But that is not what they did ask, and we don't know if that was what they meant. Mathematicians hate questions that begin “find the next number in this list”. To a mathematician, a finite list is not a sequence, and any number, or none at all, could be next.
Instead, the mathematical version of the question looks like this:
Is the sequence of positive odd integers a linear sequence?
How do we resolve this? Not by scientifically examining the sequence itself. It is infinite and also has no concrete existence. Instead, we ask what properties the abstract sequence has. One way it could be defined is:
The sequence of positive odd integers, called $\mathcal O$, is the sequence whose $n$th term is $2n-1$.
(Just for this post, let's agree that this needs no further explanation.)
And next, what does it mean for a sequence to be linear? One way is:
A sequence is linear if there exist numbers $a$ and $b$ for which the $n$th term of the sequence is always exactly $an+b$.
With these definitions, it's trivial to conclude that $\mathcal O$ is linear. If we take $a=2$ and $b=-1$ in the definition of ‘linear’, it matches up exactly with the definition of $\mathcal O$. Even though $\mathcal O$ is an infinite object, we can conclude that it is linear by considering its properties and how they relate to the property of being linear.
Here's a less silly example. Let $S$ be the sequence whose $n$th term is the difference between the $n$th perfect square and the previous square. So for example the 10th element of $S$ is the difference $$10^2 - 9^2 = 19.$$ Is sequence $S$ linear?
$S$ here is completely specified, much more clearly than if I were to list the first million terms. Many sequences begin with those same terms.
You asked “when do we ever know the rule of a sequence if there is no context?” This is right on the nose! We cannot know the rule of a sequence from a list of some of its terms, we can only guess at what the writer might have had in mind.
But the abstract description says literally everything there is to know about $S$, not just the first million terms but all the rest too. What's the one-millionth term of $S$? It's $1000000^2 - 999999^2 = 1999999$. What's the term after that? It's $1000001^2 - 1000000^2 = 2000001$. We don't need too see a list of terms, because a sequence is not a list of terms, it's a collection of properties.
How can we decide if $S$ is linear? Not by dealing with its individual terms, but by dealing with its properties. We can use simple algebra to show that $S$ is actually the sequence of positive odd integers $\mathcal O$, disguised:
- $S$ is the sequence whose $n$th term is the difference between the $n$th perfect square and the previous square. (Because I said so.)
- That is, the $n$th term of $S$ is $n^2 - (n-1)^2$
- Algebra tells us that $n^2 - (n-1)^2 = n^2 - (n^2-2n+1) = 2n-1$
- So the $n$th term of $S$ is equal to $2n-1$
- That's exactly the property that defines the sequence of positive odd integers
We already knew that $\mathcal O$ was linear, and now we know that $S$ is equal to $\mathcal O$, so $S$ is linear. And notice: we can come to this conclusion without knowing even a single one of the terms of $S$.
That is how mathematics deals with infinite objects like sequences, and usually with finite objects too. Not by examining data, but by reasoning about properties.