Check your local route schedule to see which towns you pass through around dusk. During fireworks season, most towns start their show around 9:45 PM.
Then, check the fireworks schedule for those towns. Not all towns do fireworks on July 4th. Some areas near me do them on July 1, 2, or 3, depending on which day of the week Independence Day occurs.
It really is luck of the draw. The train could be early or late, the show could be rained out, or it might start right after you pass through an area.
I've never caught any on the train, but I do get treated to a lot if I'm driving down I-94 between Kalamazoo and Detroit that time of year. With all of the farmland, it's easy to see way off in the distance.