Inappropriate Staring at the Opposite Gender
The basis for the prohibition of staring at the opposite gender inappropriately is the pasuk "ולא תתורו אחרי לבבכם ואחרי עיניכם אשר אתם זונים אחריהם. למען תזכרו ועשיתם את כל מצותי והייתם קדושים לאלהיכם" Chazal understand it to mean that one's eyes shouldn't gaze at inappropriately dressed women because it leads to sin.
Staring at a Woman
- It is forbidden to stare at any part of a woman's body, even her pinky, if one intends to derive pleasure from looking at it. This is a particularly serious sin.
- It is permitted to stare at one's wife even when she's a Niddah even if it brings one's pleasure (nonetheless, it in some contexts it is still totally inappropriate). Nonetheless one may not look at certain parts of one's wife.
- For purposes of marriage, it is permitted and proper to look at one's intended wife before marrying her. 
- Aside for staring, there is a general prohibition to have inappropriate thoughts (Hirhurim) about the opposite gender.
Following Women in the Street
Even though today it isn't possible for a man not to walk behind a woman at all when walking in the street, still a person should be careful what he looks at when walking.
- Bamidbar 15:39
- Sifrei Bamidbar 115, Nedarim 20a
- Maharshal (Ketubot 2:3) writes that just looking is permitted even for a talmid chacham but not to look intently or stare.
- Brachot 24a, Rambam (Isurei Biyah 21:2), Shulchan Aruch EH 21:1. The Bet Shmuel 21:2 writes that it is Biblically forbidden according to the Rabbenu Yonah (Igeret HaTeshuva 19, cited by Bet Yosef 21:2) and rabbinically forbidden according to the Rambam. Either way, having inappropriate thoughts (Hirhur) about such a woman is Biblically forbidden.
- Yoma 74b
- Rambam Issurei Biyah 21:4
- Nedarim 20a, Raavad (Issurei Biyah 21:4)
- Kiddushin 41a, Rambam Ishut 3:19, Shulchan Aruch EH 21:3. See Yaavetz (Shabbat 53b) who says that for a very modest person it is permitted to get married without seeing one's intended wife.
- Ketubot 46a, Shulchan Aruch EH 23:3
- The Gemara Brachot 61a states that it is better to walk behind a lion than a women in the marketplace. Rav Shlomo Zalman Auerbach in Minchat Shlomo 1:91 writes that today since there are as many women as there are men on the street unlike in the days of chazal it is impossible not to follow a woman in the street. Rabbi Willig (approx min 30) added that even though it is impossible not to walk behind women but still you need to be careful of what you see. Rav Nissim Karelitz in Chut Shani (Shabbat v. 3 p. 268) writes that nowadays when it is impossible not to walk behind a woman in the streets one should walk quickly so as not to follow a particular woman.