As the name says,
beforeClass - This is used to invoke before class activities, in case you are using one test per class, or yo - Thu want to execute all tests in class in one browser you can initiate browser instence at class level.
afterClalss- If you are using before class, we use afterClass to complte activity we started.
beforeMethod - In case of you need to start certain activity before method, such as initiating browser, logging in, initiating reporting instence, before each test, we use beforeMethod.
afterMethod- This is used in case to complete certain actions to be completed after @Test method is over
beforeSute - This is utilized to initiate stuff before Suite, such as reading TestNG.xml file and getting list of parameters, initiating report directory, purging cache, etc.
afterSuite This is utilized to initiate after execution activity such as writing report files, zipping and emailing the same.