I was given the following definition of theories:
A theory T is a set of closed formulas such that if T |= F then F is an element of T.
I am looking for some example theories to understand intuitively what theories are. Linear arithmetic over rationals is mentioned in my textbook but I don't really understand why that is an example theory.
First, I think the following explanation might be helpful:
You want to think of a theory as first and foremost a set of statements. So a theory is something like "$\{$John is a man, John owns a car, $2+2=5\}$" (I never said they have to be good statements!).
But there's two caveats here:
We're not interested in arbitrary statements, but rather statements of a particular form: specifically, a theory is a set of statements which can be expressed by a sentence of first-order logic ("sentence" is a snappier term for "closed formula").
We aren't interested in arbitrary sets of sentences; we're interested in sets which are closed under deduction. So e.g. if "$\forall x(A(x)\implies B(x))$" and "$A(c)$" are each in our theory (here $A, B$ are unary predicate symbols and $c$ is a constant symbol), then "$B(c)$" had better be in our theory. So our theories are "smart" - they know (or rather, contain) all the things they ought to. Not all authors demand this of theories, and in fact I missed this requirement the first time I read your question.
A useful comment on the second bullet is the following: any set of first-order sentences at all can be used to generate a theory - if $S$ is a set of sentences, we let $\langle S\rangle$ (the theory generated by $S$) be the set of sentences provable from sentences in $S$: $$\langle S\rangle=\{p: S\models p\}.$$ It is not immediately obvious that $\langle S\rangle$ is in fact a theory! However, it is, and this is a good exercise. Another good exercise is to show that for any structure $\mathcal{M}$, we have $\mathcal{M}\models S$ iff $\mathcal{M}\models \langle S\rangle$, so there's really no (semantic) difference between $S$ and $\langle S\rangle$.
What's the point of talking about theories generated by sets of statements? Well, it makes them easier to describe! Rather than listing all infinitely many sentences in a theory, I can just tell you enough sentences to generate the whole theory, and usually this is very easy to do. We'll see below examples of theories which are given as the theories generated by some sets of sentences.
My favorite example of a theory is the theory generated by the following set of sentences: $$\{\}$$ This is a very silly theory - the only things in it are the axioms of logic itself, like "$\forall x(x=x)$."
OK, what about a non-stupid example?
One natural example is the theory of linear order. Our language here is $\{<\}$ (where "$<$" is a binary relation symbol), and the closed formulas which make up our theory are generated by the set containing just the following three formulas:
Transitivity: $\forall x\forall y\forall z(x<y \wedge y<z \implies x<z)$.
Asymmetry: $\forall x\forall y(x<y\implies \neg(y<x))$.
Irreflexivity: $\forall x(\neg x<x)$.
These are each closed formulas; the set of these three formulas is a theory, and this is the theory of linear order. (Sometimes the theory of linear order is developed for $\le$ in place of $<$, in which case asymmetry and irreflexivity get replaced by "$\forall x\forall y(x<y\wedge y<x\iff x=y)$".)
Another good example of a theory is the theory of groups. Here our language is $\{e, ^{-1}, *\}$ where $e$ is a constant symbol, $^{-1}$ is a unary function symbol, and $*$ is a binary function symbol; and one collection of closed formulas which generate our theory consists of the following:
Identity: $\forall x(e*x=x*e=x)$.
Inverses: $\forall x(x^{-1}*x=x*x^{-1}=e)$.
Associativity: \forall x\forall y\forall z((x*y)z=x(y*z))$.
And finally, we can have another stupid theory! Our language $\{c, d\}$ has two constant symbols, and our theory is generated by the following two sentences:
$\neg c=d$.
$c=d$.
There's no rule saying that a theory has to be consistent! It's a good exercise to show that this theory is exactly the set of all sentences - that is, a contradiction lets you prove everything.