I worked for a dealership that offered engine replacement for the life of the vehicle, they never replaced an engine in my 18 months there but they sure made a lot of money off of this promotion.
First, all service had to be done by their dealership. It's not like a cars warranty where as long as you can prove it was done, the warranty will be honored. This is their offering and they can make the rules. The service schedule must be followed to the letter and the dealer's service department must be the one to perform the work.
Second, this only applied to cars that were out of warranty. If it was under warranty, the manufacturer paid for the engine replacement. If they declined the warranty, then you probably failed to perform adequate service and therefore getting the dealership off of the hook for replacing it.
Third, engines for life were only for the original purchasers of the vehicle. Not too uncommon, but still a surprise to some people.
All in all, even if the dealership did have to replace an engine in a customer's car, they still made more money off of servicing it than they spent in replacing the engine. Promotions like this are simply money generators, it brings customers in to purchase cars (who doesn't want free engines for life! and it makes sure that they service their cars there, and many dealers make the most money through their service department.