Atmega naming scheme (324p vs 328p)
The numbers of Atmega devices follow a quite simple basic scheme. Let's take the Atmega644PA-AU as an example.

&quot;64&quot; The first digits always mark the size of the Flash in Kibibyte

This is always a power of 2, between 2 and 256. The 4808 is the only exception with 48kB of memory
The RAM is in most cases a factor of 8 or 16 smaller than the Flash


&quot;4&quot; The last digit marks the series of chips. Within a series they are often pin-compatible and share a similar set of features. Some prominent series are:

'no digit' - these are the first generation chips with 8 to 128 kiB Flash
'8' - a series from 4 to 32 kiB Flash, all in the same housing. More or less an improved version of the original chips
'4' similar to '8', but in larger packages with more pins (~40 instead of ~30) and up to 128 kiB Flash
'5' similar to '4', but with more timers and PWM channels
'0','1' rather old family with large packages (60 - 100 pins) and up to 256 kiB Flash.
'9' with integrated LCD controller
'U2', 'U4' are the two sizes of USB-enabled controllers
'08', '09' newest family with additional configurable logic and more CPU-bypassing features
'50', '90' the largest chips with 100 pins, but few peripherals


'PA':

'A' and 'B' are newer revisions, usually without major changes.
'P' is 'pico-power' - chips with very deep sleep modes and quite low power consumption, ideal for battery-powered applications
'L' and 'V' are sampled for lower voltage operation at slower clock speeds (old series only, newer have this 'built-in').


'-AU' The letters after the dash mark

the kind of packaging (LGA, DIP, QFN...)
the temperature range (industrial, consumer)
the shipping packaging (tube, reel)
default fuse settings (e.g. internal oscillator on 32U4)
lead content (obsolete)



The even smaller Attiny controllers follow a similar scheme, but have more and smaller families with more specialized sets of features.
Notable is the Attiny[2,4,8,16,32][0,1][4,6,7] (e.g. Attiny204 up to Attiny3217) series that extends the Atmega[8-48]0[8,9] towards smaller memory and fewer pins.
As of 2020, there are a two new Atmega-related series: AVR-DA and AVR-DB which seem to be very similar to Atmega, but with some improved and more modern features.

In summary: You can learn quite a lot about the device from its number, but for details and precise numbers you always have to look into the datasheet.
Microchip offers a handy Quick Reference Guide where families of chips are grouped - but be careful, some entries are wrong (e.g. 324PB, 32U4).
Basic buying guide for Atmega: Use a ..4 or ..8, depending on the number of I/O and peripherals you need. 'P' and 'B' are always favorable. For communication with a PC, use a U2 or U4. Battery powered devices that have to react on external signals might profit from the new ..[0-1][4-9] series.
For special needs, check the rest of the species.