A person will be with whom he loves (Bukhari, Muslim)
This statement of the messenger of Allah s.a.w. was in response to someone who came and inquired, "O Messenger of Allah, what do you say about someone who loves a group of people, but is unable to join them?" What is meant by a group of people is the learned or righteous people, and what is meant by, "was unable to join them," is a person who was unable to gain their company or achieve the same status as them in knowledge and action. To this the Messenger of Allah s.a.w. replied, "A personwill be with whom he loves," i.e. he will be gathered with them on the day of judgement.
Allah s.w.t. says, "Whosoever obey Allah and the Messenger, they will be with those unto whom Allah has shown favor, of the Prophets and the saints and the martyrs and the righteous. The best company are they" (Quran 4:69-70).
This hadith could also be applied more generally to those who aspire to be with evil people and sinners and secretly admire their actions, even though they may not have perpetrated those evil actions themselves, They will be gathered with the sinners on the day of judgement (Mirqat al-Mafaatih 8:740).
Taken from Zaadut Tolibin.