All five sentences are grammatically correct, but they don't all mean exactly the same thing. The differences come down to emphasis, tone, and clarity.
1. He resigned as manager after eight years.
This is the most natural and commonly used version. It clearly means he stepped down from the role of manager after eight years. The phrase "as manager" tells us the specific position he resigned from.
2. He resigned as a manager after eight years.
Also correct, but slightly more general in tone. Saying "a manager" suggests he may have been one of several managers, or it may not refer to a specific managerial position. It's a bit less direct than sentence 1.
3. He resigned the position of manager after eight years.
This version is more formal. It means the same as sentence 1 but sounds more official or written, such as in a report or announcement.
4. As a manager, he resigned after eight years.
This sentence is grammatically fine, but a little unclear or vague. It tells us that he was a manager at the time he resigned, but it doesn't clearly state that he resigned from the manager role. It's possible he resigned from something else while holding the position of manager.
5. As a manager, he resigned his position after eight years.
This version is clearer than sentence 4. It makes it more specific that he resigned from his position as a manager. It's also slightly more formal in tone.
In summary:
All are correct, but sentence 1 is the clearest and most natural for general use. Sentence 3 and 5 are more formal. Sentence 4 is less specific and could be misunderstood.