Attain is all about reaching some mark of achievement—you can attain a destination. You can attain your goal. If you win over and over at the blackjack tables, you might attain a reputation for success.
Attain derives in part from the Latin tangere "to touch," which is also at the root of retain "to keep," obtain "to get," contain "to control." One might obtain the discipline to contain one's emotions while studying, thereby attaining control and retaining more information.