Examples of badly behaved derivatives Consider a real valued function $g$ on an open interval $(a,b)$ which is the derivative of a function continuous on $[a,b]$ at each point of $(a,b)$. The function $g$ has the intermediate value property, so a monotone $g$ will have to be continuous, a general $g$ cannot have simple discontinuities, etc. With such constraints how badly can a derivative behave in terms of continuity, can it get much worse than the derivative of say, $x^2 \sin(1/x)
$?
 A: I think it can.  In particular, Wikipedia's antiderivative (current revision) page seems to imply that, for any meagre $F_\sigma$ subset of an open interval, one can construct a function whose derivative is discontinuous on that subset.  It also gives some examples.
A: In Y. Katznelson and K. Stromberg’s paper “Everywhere differentiable, nowhere
monotone, functions,” Amer. Math. Monthly 81 (1974), no. 4, 349–354 (doi: 10.1080/00029890.1974.11993558, JSTOR), there is a construction, based on somewhat similar ideas to those described in Majer’s above mentioned article, whereby for any two disjoint countable sets $A, B \subset \mathbb{R}$ there exists a differentiable function whose derivative equals $1$ on $A$ and is less than $1$ on $B$.   So if $A$ and $B$ are both dense in $\mathbb{R}$ then this derivative must be discontinuous at every point of $B$.
A: Of course every continuous function is a derivative, so your question seems like it could be reinterpreted as the characterization problem for derivatives: that is, give "nice" necessary and sufficient conditions on a function $f: [a,b] \rightarrow \mathbb{R}$ for it to be the derivative of some other function (one-sided, at the endpoints).
As others have pointed out, any derivative must be a Darboux function -- i.e., satisfy the conclusion of the Intermediate Value Theorem -- and also a Baire class one function -- i.e., a pointwise limit of continuous functions.  The latter implies that the set of discontinuities is meager.  A lot of work has been done seeking to understand "how much bigger" the class of Darboux, Baire Class 1 functions is than the class of derivatives.
Here are some references:

Bruckner, A. M.; Leonard, J. L. Derivatives. Amer. Math. Monthly 73 1966 no. 4, part II, 24--56.

http://alpha.math.uga.edu/~pete/BrucknerLeonard66.pdf or http://classicalrealanalysis.info/documents/andy1966.pdf

Bruckner, Andrew M. Differentiation of real functions. Lecture Notes in Mathematics, 659. Springer, Berlin, 1978. x+247 pp.

https://projecteuclid.org/euclid.bams/1183545222

Bruckner, Andrew M.
The problem of characterizing derivatives revisited.
Real Anal. Exchange 21 (1995/96), no. 1, 112--133.

https://projecteuclid.org/euclid.rae/1341343228
A: Derivatives are like continuous functions in that both have the intermediate value property, but they need not have the extreme value property.  Gelbaum and Olmstead, Counterexamples in Analysis, gives as example 3.7 the function
$$
f(x) = \begin{cases} x^4 e^{-\frac{1}{4}x^2}\sin\frac{8}{x^3}, & x \ne 0 \\ 0, & x=0 \end{cases}
$$
for which $f'$ exists everywhere, but does not achieve its supremum on the compact interval $[-1,1]$.
On the other hand, a derivative cannot have too many discontinuities.  Lars Olsen at  Link points out that a derivative is a pointwise limit of the continuous functions and hence of Baire class at most 1, and therefore its set of discontinuities is meager (in particular, has dense complement).
A: Talking about how bad may be the derivative of an everywhere derivable function on the interval $[a,b]$, the natural example that occurs to my mind is: a Pompeiu derivative, that is, a derivative that vanishes in a dense set (these weird functions, however, constitue a closed linear space of $C^0[a,b]$, while it's not even obvious that they are closed wrto addition!). For an account on the subject you may refer e.g. to the above quoted book by Andrew M. Bruckner Differentiation of real functions: it's also in the CRM series now (here is a preview:
Google Books).
For a quick reference, you may also have a look to the wiki article (it's me who wrote it ;-) ).
