Calculating probability that a probability of heads lies in a given interval Suppose you flip a coin $n$ times and you get heads $x$ times where $x < n$. 
By what confidence can you say that the probability of the coin showing heads during a random toss lies between $U_1$ and $U_2$ ( $0 < u_1<u_2 < 1$)?
For example if I flip a coin 500 times and I get head 240 times, what is the probability/confidence with which I can say that probability of getting heads lies between .45 and .55?
 A: If probability of heads is known
If probability of heads is known, then you are not asking about confidence interval (check here and here for definition and further details), but about distribution quantiles. If you toss your coin $n$ times and observe $x \le n$ heads, then the tosses can be described by a binomial distribution parametrized by the number of tosses $n$ and probability of tossing head $p$. If you asked "what is the probability of observing $x$ or more heads in $n$ tosses?", you would be asking about cumulative distribution function
$$ \Pr(X \le x) = F_X(x) = q $$
quantile function answers the opposite question, i.e. "what is the value of $x$ such that $\Pr(X \le x) = q$ for a given value $q$?",
$$ F_X^{-1}(q) = x $$
more precisely, since cumulative distribution function of a discrete distribution is a step function, we need a generalized inverse distribution function for it
$$ F_X^{-1}(q) = \inf  \{\, x \in \mathbb{R}: F_X(x) \geq q \,\} $$
Binomial distribution does not have a closed-form quantile function, but most statistical software offers you to calculate it numerically (e.g. qbinom function in R). It can be also calculated "by-hand" for discrete distributions like binomial, since you can compute cumulative probabilities $q_i$ for each $x_i = 0,1,2,\dots,n $, and then simply choose such values of $q_i$ that correspond to the probabilities of interest.
If probability of heads is unknown
If, as stated later on in comments, we are dealing with hypothetical coin "whose properties are completely unknown", then this is a different problem. We would still assume binomial distribution for counts of heads $X$, but the "unknown properties" can be understood as assuming that probability of heads $p$ is a random variable. As noticed in the comments below by amoeba and Xi'an, this can be assumed as a Bayesian problem, in terms of beta-binomial model.
Since $p$ is random and can be anything, we assume for it a "uniform" prior, i.e. beta distribution with parameters $\alpha = \beta = 1$. If we toss the coin some number of times, then we can update our prior for the additional information. Since beta is a conjugate prior for binomial distribution, updating is very simple and updated parameters become $\alpha' = \alpha + \text{number of heads}$ and $\beta' = \beta + \text{number of tails}$ and the quantiles of interest can be calculated from posterior beta distribution parametrized by $\alpha'$ and $\beta'$.
The interval of interest can be easily obtained using theoretical quantiles. Two different kinds of intervals may be obtained in this scenario:


*

*interval for number of heads $x$, that can be calculated from posterior predictive distribution that in this case is a beta-binomial distribution, or

*interval for possible values of $p$ that can be calculated from beta distribution.
As noted above, the interval can be calculated before seeing any data from prior distribution parametrized by $\alpha = \beta = 1$, or after seeing some data and updating for it, from posterior distribution parametrized by $\alpha'$ and $\beta'$. Each time you observe new data you can update your posterior for it to make your estimate more and more precise.
A: Assuming coin flips are independent, the number of heads has a binomial distribution with mean $np$ and variance $np(1-p)$, where $n$ is the sample size and $p$ is the true success probability.  To construct the interval you first specify the confidence level (often taken to be 95%). You can compute the confidence interval for the exact binomial using what is called the Clopper-Pearson method. If the sample size is large such as the 500 you posed as an example, then you can use the normal approximation to construct the interval.  If the interval contains 0.5 you cannot reject the hypothesis that you have a fair coin.  If 0.5 lies outside the interval you would conclude that the coin is biased with a significance level equal to 1 - the confidence level, where the confidence level is expressed as a proportion.
