You can delete trailing spaces with the following command.
:%s/\s\+$//e
This command is explained as follows:
:% (default would be for the current line)s/ start of the search pattern\s whitespace character\+ escaped + sign, one or more spaces should be matched$/ end of the search pattern, beginning of replacement pattern/ end of the replacement pattern. Basically, replace with nothing.e suppress error messages if no match found