There is no purpose behind these classifications it is just a way of dividing stanzas and collection of verses in Sanskrit language.
Suktam/Sukta refers to a vedic hynm of unmanned composition, since vedas are apaurusheya they are of divine origins (It is best way to worship a deity but for word of caution it is only meant for dwijas If you don't have had upnayana there is no way you can recite it).
Gayatri (caution dwija caution applies on gayatri or any thing of vedic origin) is a Vedic-meter and stotra is a hynm (non vedic) written by a jnani poets in praise of deities (for e.g. Adishankara krit Kanakadhara stotra more).
Ashtaka is a sub category of stotras, stotras are non-vedic compositions so it can be recited by an
Ashtaka is a collection of 8 verses mostly in anushtup chanda (another vedic meter) , mahalaxmi ashtakam was first composed by Indra deva.
Now coming to formal definitions
Sukta
It is basically a vedic hynm in praise of a god/goddesses. (e.g. Purusha Sukta, Ratri Sukta, Shri Sukta, Rudra Sukta(Shri Rudram) etc.)
Each mandala of Rigveda consists of hymns called sūkta (su-ukta, literally, "well recited, eulogy") intended for various rituals. The sūktas in turn consist of individual stanzas called ṛc ("praise", pl. ṛcas), which are further analysed into units of verse called pada ("foot"). The meters most used in the ṛcas are the jagati (a pada consists of 12 syllables), trishtubh (11), viraj (10), gayatri and anushtubh (8).
Source
Gayatri
Gayatri is basically a vedic Meter which consists of three padas, or lines, of eight syllables.
There are various mantras in Rigveda which are composed in Gayatri meter and are used for praising god in one verse it is known as Gayatri for a deity.
For e.g. "Aum | Mahalaxmiayae cha vidmahe| vishnupati cha dhi mahi| tanno Laxmi prachodayat" (| denotes ending of a pada)
Source
Stotra
Stotras are forms of poems in praise of Gods/Goddesses
Stotra comes from the root stu- which means "praise, eulogize or laud". Literally, the term refers to "poems of praise". The earliest trace of Stotras are Vedic, particularly in the Samaveda.
Source
Ashtaka
The term ashtakam (Sanskrit: अष्टकम् aṣṭakam), also often written astakam, is derived from the Sanskrit word aṣṭā, meaning "eight". In context of poetic compositions, 'ashtakam' refers to a particular form of poetry, written in eight stanzas.
Source