During Andy's escape in The Shawshank Redemption it is clear that he sees the pipe so he doesn't have to wait for the lightning to enlighten it. Why does he wait for it?
He waits to time his strikes so that the thunder will distract or mask the sound of striking the pipe.
For his plan to work, he needs to escape without anyone being alerted to his exit. Banging on a sewer pipe transmits sound through the ground, foundation, walls, and out the pipe in both directions. So inmates in the bathroom would be aware of an unusual sound, and whoever is around that section of pipe, as well as guards in many places. They may not identify the source for awhile, but they surely would start looking and initiate a lock down.