The Bible (primarily the New Testament) gives us the reasons for fasting and they are: (1) To minister to the Lord. (2) To lay hands on ministers to send them forth. (3) To draw close to God in perilous times. Although the New Testament does not tell us "to fast", it certainly does not mean that we should not.
There are not iron clad rules in the Bible regarding fasting and that is because the need for fasting is as the occasion arises. It's very important to note that fasting does not change God nor His will for your life and specific situations. God is going to be the same before, during and after your fast. The purpose for fasting is to change you and me. One of the hardest things to do in life is keep our flesh under control. 1 Corinthians 9:27, Paul admonishes us to "keep our bodies under control instead of our bodies controlling us". Fasting will also help you become more sensitive to the Spirit of God which is something we all need to make a priority in our life.
Many believe since Jesus fasted forty days that we should too, but unless you know for sure God is directing you to do so, that may not be a wise thing. Fasting for extended periods of time is not going to make something happen anymore than a shorter fast could do, unless, again, you feel strongly led of the Lord to do so. Nowhere in the New Testament are we admonished too fast for 40 days or any other specific length of days. There are some who have thought that fasting will defeat the devil, but why would that be necessary when Jesus has already defeated him? Jesus has already won that victory for you and me.
Fasting short periods of time consistently will help in keeping your body under. It is important to have a specific reason to fast. Like already mentioned, to set someone apart for ministry, to be more sensitive to the Spirit and in times of extreme hardship when you need specific guidance.
DIFFERENT KINDS OF FAST: Daniel fasted 21 days (Daniel Fast). He did not eat anything he wanted but he did eat some. We are told he ate no pleasant bread or food to be desired. He also did not eat meat or drink any wine. (Daniel 10:3) It's most commonly thought that Daniel ate vegetables, fruits, nuts, and such like. There are other kinds of fasting such as only eating broths, soups without meat for an example. The purpose is to keep our bodies under and not allow them to dictate to us what we eat.
We also can fast things unrelated to food such as television. If you are prone to watch a tremendous amount of television, then that might be a way to control the flesh while depriving yourself of so much TV. You need to be sure that the time you're taking away from TV is used in prayer. You can do a complete fast with only water, but I would advise you to only do that for a small, limited number of days unless you are sure God is directing you to do more. It is wise to consult your doctor should you do an extended fast. We can and should use some common sense in regard to fasting. When fasting correctly, it can be a real blessing to us.