People often do things that they are allowed to get away with. After all, if there's no reason not to do something, there's no reason for a man to change. So first ask yourself if you are tacitly encouraging certain behaviors. All men, women, children and most animals change their behavior to respond to stimuli. If a man consistently texts you at 3 a.m. to see if he can stay over, then you don't hear from him for another week or two, he is not going to change this behavior until you stop responding to his nocturnal messages.
Certain small behaviors may change over time. A man may have left sandwich things out when you first started dating, but years of you berating him may have finally convinced him to put the mayonnaise away. But this doesn't change the fact that he either doesn't care as much about this kind of thing as you do or is focused on other things. It is possible to change small behaviors, but it is not really possible to change the larger behaviors that govern them. So if a man consistently leaves mayonnaise out, and then after you finally get him to start putting that away, he starts leaving orange juice out, you can take this as a sign that, in general, he's always going to leave things out.
Although it is possible to change some behaviors, others are simply set in stone. If you've been dating a man for five years, and every two weeks you fight with him about the same issue, come to terms with the fact that this is who he is. There are certain aspects --- positive and negative --- of people's personalities that do not change, and if you have tried to change them with little to no success, accept that you are never going to be able to change them and move on.
Ask a man's old friends or his family if they have ever seen him exhibit certain annoying behaviors. Obviously, only ask about relatively minor things --- like leaving his bed unmade for days at a time or putting his shirts on inside-out --- and you should only ask these questions once you've been dating for a while. However, if a man's old friends or his family confirm that he has been doing these things since he was young, come to terms with the fact that he always will do them. If his family, friends, roommates and previous girlfriends couldn't change his behavior, you probably won't be able to.