When a virus "mutates" it doesn't replace its entire genetic code. A vaccine might work just as well against a new variant if the mutations are in an irrelevant area (e.g. outside the sequence that codes for the spike protein).
Yes it might and it's not all or nothing either. Just like natural immunity can lessen the degree of future mutated infections, vaccine shots can too.
The corona's spike protein though is a simple structure that will likely still infect (be able to get inside a cell) after many kinds of mutations - some of which won't be mitigated with previous vaccinations (mu is leaning this way).
Contrast this with polio which has a Tetris like key that must link up with complex cellular proteins in our cells to enter. Slight mutations in this render it unable to pass through the cell wall. It's why vaccinating for this is so effective and long lived.