My standard answer for this is the following, copied from another answer I've given here.
If you want a thorough study of how to approach and develop algorithms, get a copy of:
David Gries, The Science of Programming
The book will change how you think about algorithms and how they are developed. One of the key ideas is algorithm development from loop-invariants along with pre- and post-conditions. There is a science (hence the name) of modifying post-conditions in order to develop a loop and its invariant.
One of the magical problems in the book is a linear time sort of an arbitrary array that contains only three distinct values (Dutch National Flag). It generalizes to a linear time sort of an array containing a finite number of distinct values.
It shows algorithm development in a way that results naturally in optimized algorithms.
However any non-trivial book on algorithms should discuss optimization and the various ways it is measured (space, time, average, best case, worst case, ...). Books advertised as "introduction to algorithms" may be a bit shallow, of course.
The gold standard, of course, is the multi-volume The Art of Computer Programming by Donald Knuth. The first chapter of the first book is a nearly complete treatise on the required mathematics. In this series, algorithms are presented in a specially constructed assembly like (very low level) language. The Gries book also uses a specially constructed language for presentation, but it is at about the level of Pascal or C.
However, if you are interested in Functional Programming (Scheme) instead, you want to start with The Structure and Interpretation of Computer Programs by Abelson, Sussman and Sussman. While this book will teach you deep concepts of algorithms, it might not be quite in the way you expect as it doesn't focus explicitly on optimization, treating optimization as more of an organic property of algorithms.
In fact, none of these books start with some "algorithm" and say "now, let's optimize it". I don't think that is a viable approach. Instead, algorithms are developed from the start to optimize on some criterion. But they are interesting partly because it is generally impossible to optimize on more than one dimension simultaneously. So most algorithms involve trade-offs of some kind. Often it is time vs space though there are other possibilities.