The Problem:
**The left part** (#nav ul li) which float: left and **the right part** (#nav .search) which float: right **are n
You have to use absolute positioning and use left and right alignment.
#nav ul, #nav .search { margin: 5px; position: absolute; display: inline-block; }
Check here http://jsfiddle.net/A8SyJ