We consider cyclic codes $\mathcal{C}_\mathcal{L}$ associated to quadratic trace forms in $m$ variables $Q_R(x) = \operatorname{Tr}_{q^m/q}(xR(x))$ determined by a family $\mathcal{L}$ of $q$-linearized polynomials $R$ over $\mathbb{F}_{q^m}$, and three related codes $\mathcal{C}_{\mathcal{L},0}$, $\mathcal{C}_{\mathcal{L},1}$ and $\mathcal{C}_{\mathcal{L},2}$. We describe the spectra for all these codes when $\mathcal{L}$ is an even rank family, in terms of the distribution of ranks of the forms $Q_R$ in the family $\mathcal{L}$, and we also compute the complete weight enumerator for $\mathcal{C}_\mathcal{L}$. In particular, considering the family $\mathcal{L} = \langle x^{q^\ell} \rangle$, with $\ell$ fixed in $\mathbb{N}$, we give the weight distribution of four parametrized families of cyclic codes $\mathcal{C}_\ell$, $\mathcal{C}_{\ell,0}$, $\mathcal{C}_{\ell,1}$ and $\mathcal{C}_{\ell,2}$ over $\mathbb{F}_q$ with zeros $\{ \alpha^{-(q^\ell+1)} \}$, $\{ 1,\, \alpha^{-(q^\ell+1)} \}$, $\{ \alpha^{-1},\,\alpha^{-(q^\ell+1)} \}$ and $\{ 1,\,\alpha^{-1},\,\alpha^{-(q^\ell+1)}\}$ respectively, where $q = p^s$ with $p$ prime, $\alpha$ is a generator of $\mathbb{F}_{q^m}^*$ and $m/(m,\ell)$ is even. Finally, we give simple necessary and sufficient conditions for Artin-Schreier curves $y^p-y = xR(x) + \beta x$, $p$ prime, associated to polynomials $R \in \mathcal{L}$ to be optimal. We then obtain several maximal and minimal such curves in the case $\mathcal{L} = \langle x^{p^\ell}\rangle$ and $\mathcal{L} = \langle x^{p^\ell}, x^{p^{3\ell}} \rangle$., Comment: 19 pages, 10 tables. We modified the abstract. We included the parameteres of the codes in the theorems (dimensions and minimal distances). We added Lemma 3.2 and Examples 4.3 and 4.5. Also items (ii) in Remark 3.5 and 4.6. Some typos corrected. We added some references also