Modern theories of
grammar, or at least those deriving from
Chomsky's generative approach, divide up
sentences not word by word but
phrase by phrase, and phrases may be composed of smaller phrases, recursively down to the level of words.
While the traditional division (deriving from the ancient Greeks) allocates parts of speech largely by morphology, that is the inflections they take, current syntax groups them by function. The categories that have been identified so far are seven in number. There might be others; but the following seven are generally agreed as fundamental. There are four lexical categories, which are more or less open-ended, capable of being added to as a language changes, and three functional categories, which have a fairly small number of grammatical realizations.
The four lexical categories are noun, verb, adjective, and preposition. The three functional categories are complementizer, inflection, and determiner. In newer versions of the theory the single letters N, V, A, P, C, I, and D are used for these. (Formerly you saw Infl for inflection, Det for determiner.)
Before I go into a bit more detail about what these classes contain, here's how they build up into larger structures. Under X-bar Theory, the basis for modern phrase structure grammars, a member of one of the categories is inserted in the sentence from the lexicon. This is the head of a larger structure built on top of it, a projection: an N projects an N' (pronounced N-bar), a V projects a V', and so on. In general an X' contains an X head plus some other material, and still behaves like an X. The topmost level at which it behaves like an X is called its maximal projection, and notated XP: thus NP, VP, and so on, standing for noun phrase and so on. These are incorporated into higher structures that are no longer projections of that head, but of another.
Under the newest approach, the Minimalist Program, there is no essential difference between levels, so X, X', and XP are all X, and reference to 'bar levels' is not allowed. But even under the earlier X-bar approach, there was no essential functional difference between them: the major part of speech known as a noun covers both N and NP. A complex internal structure does not affect the fact that externally an NP behaves as an N.
What this means is that complex expressions are of the same part of speech as their head. So 'big black cat' is a noun, just as 'cat' is; 'very proud of her only son' is an adjective, just as 'proud' is; 'smoke herrings quietly on Tuesday afternoon' is a verb like 'smoke'; and 'under the moon's fitful shadow' is a preposition. Sentences are composed of phrases organized in structures. They are not strings of words.
Phrases are attached to other phrases, at particular places in their structure. So an adjective can be adjoined either to a noun or to a verb: in the latter case it is what is traditionally called an adverb, but the distinction is not categorically important. In fact adverbs can be attached to either a verb or to a clause, with different effects. But functionally they are all adjectives. A prepositional phrase can be attached to a verb ('work in the garden'), to a noun ('shady spot in the garden'), or to an adjective ('fit for a king'); an entire clause can be attached to a noun ('face that launched a thousand ships'), an adjective ('free to go where you want'), etc. etc.
With that explanation disposing of noun, verb, adjective, and preposition, and how very large segments of the sentence can fall under one of those four, we turn to the three functional categories.
A determiner is one of those words that (in English) precedes a noun phrase and gives it some kind of reference: they may include articles, demonstratives, quantifiers, and possessive adjectives, such as 'the, a, this, that, these, all, some, no, my, your'. But in other languages, the demonstratives and possessives might actually be adjectives. What there is universally is a slot for a determiner qualifying a noun: how it's filled will be a matter for a particular language. Formerly a group consisting of D and N, such as 'the black cat' or 'my house', was regarded as an NP, with the D as its specifier; it is now agreed there are good reasons for believing it is the D that projects, making it a DP. In the case of noun-noun possessives, such as 'the man's house', the possessive noun appears to act as a determiner, but the exact analysis is debatable.
A complementizer is a word like 'if' or 'that' that connects one clause into another. The inner clause is a complement, that is an essential part of the structure of the outer clause. For example: 'I wonder if John is here', or 'John heard that Mary was there'. The if- or that-clause is essential to completing the meaning of 'wonder' or 'hear'. By contrast, clauses introduced by prepositions such as 'after' or 'while' are merely adjuncts; they could be omitted without grammatically invalidating the main clause.
But not only 'if' and 'that'. These are overt complementizer words in English. Covertly it is generally believed that every sentence is, at its heart, a CP. That is, the C position exists at the front of every clause, in every language, and is just not filled in many cases. But it is still available as a position that can be filled, and many important grammatical effects, such as WH-movement to form a question, or topicalization, work by bringing material from lower down in the sentence into the C position or the specifier adjacent to it. The C is a kind of locus of illocutionary force: whether the clause is a statement, or question, or hypothetical.
Finally, I or Infl, the inflection, often split up into several adjoining kinds of phrase, all of an inflectional nature: AgrS or subject agreement, AgrO or object agreement, T or tense, Neg or negation, and small v or auxiliary verb. It covers all the inflections the main verb takes, as well as auxiliaries like 'have' or 'do' or 'can'. A lot of it doesn't consist of words at all, but landing sites for other parts of speech to move up into and get their agreement marking checked: so the subject of the sentence gets nominative case, the verb gets tense and agrees with the subject and so on, details depending on the language. The I is regarded as the head of the whole clause, so what was traditionally called a sentence is now technically regarded as an IP, and above that a CP.
I should point out that this theory is not intended to fully displace traditional terminology, and a good descriptive grammar will still break down classes into ones resembling some traditional terms, such as adverb, subjunction, and definite article. However, how they classify items such as each or so that might be different from what's still taught in schools. Often you just can't be rigorous about what part of speech a word is. Partly it's merely a matter of alternative names, partly it's the fact that large classes group together words that are grammatically different from each other: if e.g. you tried to call each an adjective, because it precedes and qualifies a noun, you have the problem that its behaviour is markedly different from that of normal adjectives. It is more useful to call it a determiner.