According to computer, Fischer had a sloppy opening, but his kingside attack was nearly flawless.
On Fischer vs. Sherwin 1-0 (1957)

So White wants to transfer the rook to g3 (or h3) via e3. But before that he needs to address the hanging f4-bishop. There are several ways to do this. Most options allows Black a tempo to improve one of his awkwardly placed pieces. For example, 24.Qe4 will be met with 24...Kg8, when Black utilizes this tempo and moves his king to a safer square, albeit only slightly.
In contrast, 24.Re4 forces Black to move his only well-placed piece, which is the queen. 24...Qh5 does not improve Black’s position and is essentially a “wasted” tempo from Black’s perspective. Now that the f4-bishop is safe, White returns to the aforementioned plan and plays 25.Re3.
In conclusion, the Re1-e4-e3 maneuver allows White to win a tempo. That is, White saves the hanging bishop without letting Black improve his defense.
I believe that all the moves you asked about were made for pretty logical reasons. Of course, logical doesn't mean obvious! I'm no Fischer--to say the least, but I think this might help
17.h4 is just part of White's kingside attack plan. The idea is to evict Black's only kingside defender. Ideally, White would like to play h5 followed by Qxh7 mate, when the knight moves
19...Nh4 is an attempt to create some counterplay against the white king. If 19...Ne7, White snares the Rb8 with Bf4 and will be ahead in material while maintaining a strong attack. In the game, if White wins the rook with 21.Bxb8, Black plays Nxg2 followed by Bb7+ with a strong counterattack
24.Re4 threatens Be5+ winning Black's Queen, but it also starts to bring one more heavy piece into the attack. Once that rook arrives on the kingside, it's curtains
25.Re3 renews the threat of bringing the rook into the attack after Sherwin didn't fall for the discovered attack and controlled g4. Rg3 or Rh3 are the threats
I need explanation for some moves. These moves are 17. h4, 19...Nh4, 24. Re4, and 25. Re3. If I were to play through these games, these moves would never cross my mind. What sort of knowledge is required to play these? Is this based on positional understanding or tactics? In advance, thank you. I would also like to thank World Champion Robert James Fischer as well as James Sherwin for providing us with this beautiful game.