It is not necessary that an functional on a Banach space $X$ would attain its norm. However, in case of a reflexive Banach space, the unit ball remains compact under the weak topology (the minimum topology needed to maintain the continuity of each member of the $X^*$).
A general version of this is every compact operator on a reflexive Banach space attains its norm. In particular, the continuous linear functionals are compact.
Whenever, $X$ is not reflexive, no such conclusion is true. However, still we can say something about $X^*$. Every member of $X^{**}$, which are image of any member of $X$, under canonical isomorphism, attains their norm. This is because of Banach-Alaoglu Theorem, which says:
Given any Banach space $X$, unit ball of $X^{*}$ is compact with respect to the weak$^*$ topology.
Weak$^*$ topology: The minimum topology on $X^*$, needed to maintain the continuity of each member of $\psi(X)$, where $\psi: X \to X^{**}$ denotes the canonical embedding.