I think at this point the UCI
do always inspect the winner's bike after each stage. Here's a scenario where a rider could avoid most scrutiny and get away with it....
Say a rider doesn't finish in the top 5 for any early stages but stays near the top of the pack time-wise. Meanwhile they are conserving energy e.g. through use of a motor during mountain stages. Then at the end, stop using the motor and have fresh legs because you haven't been working as hard as everyone else, and experience a miraculous rise in the standings in the last couple stages and clinch the GC win?
Although if you take the '15 TDF as an example, I think it was Froome was right up top of the standings for a huge chunk of the race. So no doubt his bike was inspected many time. Generally that's how it plays out, there's rarely a dark horse that shows up right at the end.