Dear student
Raoults law is the law only for ideal solutions of two components. Now in the case of ideal solutions, the total force of attraction between the like molecules has to be exactly same as those between unlike molecules so that even before mixing whatever was the force of attraction has to be very same as the total force of attraction even after the mixing of those components. Then only the mixture will be called as an ideal solution and thus the total pressure of each component can be added to give the total pressure of the solution thus following the Raoults Law.
Regards