The best tutorial I've read on line following is here, written by Ibrahim Kamal: http://ikalogic.com/tut_line_sens_algo.php
You can opt for either an LED/LDR solution or IR LED solution (with IR photodiodes or IR phototransistors). It's all written in detail on that page. You can make your own or use ready-made line following sensors. I know that Sparkfun sell some, and Polulu probably do, too.
As for the coding segment, you will need to write your Arduino program according to Figure 4.A on the abovementioned website. There are more advanced ways to do line following, but that is the most basic way and the best way to start off.
Wish you luck!