train track change mechanism

How do they find out if a train’s track is damaged? When is it changed, know interesting fact

We all have traveled by train, but have we ever seen the railway tracks changing?…