How do I add a timer to run in the background and turn on a relay?

I am pretty new to Arduino programming and I am wondering if anyone can help me. I have a simple setup which uses a float switch to turn on and off a motor via a relay. However I need to turn on the relay after a certain period of time anyway whether the button is pressed or not to act as a fail safe. I have tried using the 'delay' function but it will not allow for the input of the buttons. Hope somebody can help?

Check out the blink without delay example. It is included with the IDE.

These links may also help:

http://forum.arduino.cc/index.php?topic=223286.0