As per the rule, you need to write 150 words in IELTS Writing task 1 and 250 words in IELTS Writing task 2. There is no upper limit you can write 500 words in task 1 and 1000 words in task 2 but it is totally up to you. I would never recommend that at all. Try to write maximum of 170 words in IELTS Writing task 1 and 270 words in IELTS Writing task 2.
But the question is still How to count the words??
Mostly students are counting words one after one but this is the worse method to do so. You can do it in even simple way. Let me explain it with a simple example Look at the paragraph mentioned below
In the above-mentioned paragraph there are in total 51 words but let’s try it with another method count words in one line and then multiply it with total lines ( 12 words in 1 line and total 4 lines = 48 words) Now this is a more simple method, there is a difference of 3 words but it’s not that high.