First, it is clear that the right to sublicense doesn't give you the right to relicense.Let's say we have a library with MIT license(1 file), someone adds some features to the library but puts them under GPL(in the same 1 file). Or if someone wants to sublicense they have to separate the code?If someone wants to use the library, how are the licenses handled? Let's say that the developer uses only the features under the MIT license even if in the file there are some features under GPL. Does he have to GPL his application because of the GPL licensed code? Does he have to remove the GPL code in order to be free of the GPL restrictions or he can just use the library under MIT permissions/restrictions as long as he doesn't use the GPL code?
What sublicense actually means?
licensing;gpl;mit license
someone adds some features to the [MIT] library but puts them under GPL(in the same 1 file).  If someone [else] wants to sublicense, [do] they have to separate the code?If by sublicense you mean use the code under the less-restrictive MIT license, then yes.  The person GPL'ing their new code is basically saying, You can't use my code unless your code is also distributed under the terms of GPL.Does [the sublicensor] have to remove the [newly-licensed] GPL code in order to be free of the GPL restrictions?Yes.