NO gm in the right mind will think 20 to 30 moves ahead. And besides even strong chess engines dont usually look that ahead.
GM games

Gms can not think one or two move ahead.
They have knowledge and they know the patterns and the power of them comes from strategies.
An Engine thinks millions of positions and make the best move. Tactically you can never defeat an engine unless it is made handicapped
Even if there is mate in 6 or mate in 50 engine would execute it. But if there is mate in 4 or 5 an human even though he is a gm or master would make it a win easily but in more moves than suggested by an engine
Here is the famous game but even likes of Morphy could not see that it was mate in 6 and he goes on to win the game but not in an engine style
here is the real solution of the puzzle
20. ... Bg2+ 21.Kg1 Bxf3+ 22.Kf1 Rg2 23.Qe2 Rxe2 24.d4 Rxh2 25.Rxe2 Rh1+

Thanks everyone of your opinion. I must tell you all that i have heard a news (may be rumour) say that Garry Kasparov is able to think ahead 32 moves. I dont know where this news come from. I just assume it is a rumour. Is it true? May anyone comment?

haha its not true, GMs at most will probably look 5-10 moves ahead, but thats at most, in a forcing position where options are very limited.
after 30 moves in a chess game, I believe the number of possible positions was something like 30x10^72 or something, which is insane, and clearly outside the capability of the human mind to see.

Then read the book
How to think like a gm?
They think like a tree is.
You know what the tree is all about?
It has so many branches and at the same time it has so much of roots down under the ground.
So gm is like a tree down to earth but also up in the air. Straight upright, serious, firm .

asking how a G>M thinks is akin to ---how does a carpenter think? Seeing a position thousands of times leads to putting the car in auto drive......anyhow thats my opinon.

There was a famous study wherein GMs were given a position from a real game, asked to look at it for 5 seconds, then set it up from memory. They did very well. When given a random position (legal, but not from a real game), they could not do it. GMs have many patterns in their heads, so they know what to look for at many similar positions. I have read the best way to improve your game is to play over many high quality games so that you too will build up this pattern memory.

Thanks everyone of your opinion. I must tell you all that i have heard a news (may be rumour) say that Garry Kasparov is able to think ahead 32 moves. I dont know where this news come from. I just assume it is a rumour. Is it true? May anyone comment?
Someone who hardly knows how to play chess can see many moves ahead if they moves are inane. E.g. kings shuffling back and forth.
Anyone who can play a blindfold game can see at least 40 moves ahead, and they'll probably be reasonable in the sene they aren't random as the first example.
The point isn't visualizing moves ahead, which is easy, but visualizing good moves, and correctly evaluating the resulting position. Sometimes strong players need to calculate a lot to reach a conclusion, sometimes they don't calculate at all, they can just evaluate the current position.
If I play a 1300 player, I can almost guarantee they will calculate much more than me (except maybe when a critical position is reached). I believe if I played a GM, I would calculate much more than them (except again, when a critical position is reached).
good day,
how to study Grand Master Games (especially in chess book) for beginners level (like me)? i dont understand any purpose of any move. From what i can see, GM make moves with thinking ahead 20-30 moves. compare to me i just can think ahead araound 3-5 moves the most. any one can explain.