What happens to a resource on a task if I replace the resource on the project with a different resource?

If the existing resource has only one assignment for the project on the Manage Project Resources page, then the new assigned resource replaces the existing resource on all task assignments for the project.

If the existing resource has multiple assignments on a project, and on one of the assignments the resource is replaced by a different resource, then the new resource doesn't replace the existing resource on any tasks.