Basis of ring of algebraic integers and free modules I believe this question is very dumb.
We know the following proposition from Algebraic Number Theory, by J. Milne:

In particular, if $[K:\mathbb{Q}]=n$, then the ring of integers $\mathcal{O}_{K}$ is a free $\mathbb{Z}$-module of rank $n$.
Since $K$ is a finite extension of $\mathbb{Q}$, then $K=\mathbb{Q}(\alpha)$ for some $\alpha \in \mathcal{O}_{K}$. The minimal polynomial for $\alpha$ has degree $n$ and $\{1,\alpha,...,\alpha^{n-1}\}$ form a basis of $K$ as $\mathbb{Q}$-vector space. In particular, $\{1,\alpha,...,\alpha^{n-1}\}$ is $\mathbb{Z}$-linearly independent.
So, I have a set linearly independent with $n$ elements. I believe it is a basis for $\mathcal{O}_{K}$ as $\mathbb{Z}$-module. Therefore $\mathcal{O}_{K}=\mathbb{Z}[\alpha]$. But it is not true in general.
For example, if I take $K=\mathbb{Q}(\theta)$ where $\theta^{3}+\theta^{2}-2\theta+8=0$. Then $\{1,\theta,\theta^{2}\}$ is not a basis because $\beta =\frac{\theta+\theta^{2}}{2}$ is algebraic integer and $\beta \notin \mathbb{Z}[\theta]$.
I would like to understand why there is no contradiction between the proposition and the set $\{1,\alpha,...,\alpha^{n-1}\}$ is not always a basis for $\mathcal{O}_{K}$. 
I believe that the problem is that I can have a linearly independent set with n element, n = rank of the free module, but this set does not span the free module.
 A: I am not totally sure about what you are asking, since you ask why there is no contradiction between the proposition and some set not being a basis, as it is clear that one does not contradict the other (since both are true).
Let me try to guess what is your problem, by making some clarifications: 
If $K/\mathbb{Q}$ is a finite extension of degree $d$ and $K=\mathbb{Q}(\alpha)$ with $\alpha \in \mathcal{O}_K$, then $\mathbb{Z}[\alpha]$ has rank $d$ as $\mathbb{Z}$-module, and hence $\mathbb{Z}[\alpha]\subset \mathcal{O}_K$ has finite index, but it is rarely an equality. 
Another question if it one can choose $\alpha$ such that $\mathbb{Z}[\alpha]= \mathcal{O}_K$; this is of course, a property of the field, and the answer is again negative in general. Such fields are called monogenic fields. 
Finally, since  $\mathbb{Z}[\alpha]\subset \mathcal{O}_K$ has finite index, say $m$, then we have $$K\supset \mathbb{Z}[\frac{\alpha}{m}]\supset \mathcal{O}_K$$
which is a way to make explicit what the proposition says in this case. 
A: For a free module over a field (or skew-field), a maximal linearly independent set is a basis. But that is certainly not true over an arbitrary ring.
A silly example: $\mathbb Z$ is a free $\mathbb Z$-module of rank $1$, but the maximal linearly independent set $\{ 2\}$ is not a basis.
