In Scripture we see several purposes for fasting. Its part of the discipline of self-control; its a way of sharing that we depend on God alone and draw all our strength and resources from him; its a way of focusing totally on him when seeking his guidance and help, and of showing that you really are in earnest in your quest; its also, at times, an expression of sorrow and deep repentance, something that a person or community will do in order to acknowledge failure before God and seek his mercy.
We tend to think of fasting as going without food. But we can fast from anything. If we love music and decide to miss a concert in order to spend time with God, that is fasting. It is helpful to think of the parallel of human friendship. When friends need to be together, they will cancel all other activities in order to make that possible. Theres nothing magical about fasting. Its just one way of telling God that your priority at that moment is to be alone with him, sorting out whatever is necessary, and you have canceled the meal, party, concert, or whatever else you had planned to do in order to fulfill that priority.