yogaś citta-vṛtti-nirodhaḥ - I.2
Yoga is the restriction or restraint of thought.
There are two types of yoga - 1. restriction of thought to a single concept or idea (samprajnata samadhi) and 2. the total restraint of all mental content (asamprajnata samadhi).
Restriction of thought can take place in a variety of different mental states but not all of these types of restriction are qualified as yoga.
You can be totally absorbed in watching a movie or playing a video game, you can be intoxicated to such an extent that your mind gets fixated or until you stop thinking all together - these do not qualify as yoga.
There are five states of mind in which the mind can become fixed on an object: kshipta (distracted), mudha (confused), vikshipta (agitated), ekagra (one pointed) and niruddha (restrained) - only the last two qualify as yoga.
Ekagra (one-pointedness of mind) refers to samprajnata and niruddha (restrained) refers to asamprajnata samadhi.
There are four levels of samprajnata yoga:
Vitarka, vichara, ananda and asmita samadhi. These different types of samadhi each depend on a different object of contemplation. Vitarka results from contemplation on a physical object, vichara on a subtle object, ananda from meditating on the feeling of bliss and asmita from meditating on the feeling of "I am". These are all described later in the chapter.
Beyond samprajanata samadhi is asamprajnata - while the first type is experienced through the mind, the second type is experienced beyond the mind - as pure consciousness. This is also described later in the chapter.
There are 64 yogic arts and sciences, each of which can lead the practitioner to samadhi. Hatha yoga or Ashtanga Yoga is just one of these. Other arts and sciences include playing a musical instrument, singing, dance, cooking, mathematics etc - each of these arts and sciences can bring the mind to deep concentration and samadhi.
Why is samadhi important? Samadhi brings deep knowledge of the object contemplated upon (Einstein developed his theory of relativity through deep contemplation on the nature of the movement of objects through space).
The second fruit of samadhi is self knowledge. This is the main purpose of yoga. According to yoga, the nature of the Self is pure consciousness. Samadhi brings one to an awareness of this, our intrinsic nature.