Is there a way to measure the remaining space of a line of text?

You could use TikZ for this by placing an empty TikZ picture in \measureremainder which then measures the distance of its position to the right border of the text area. This requires at least two compiler runs to work. It reuses some code from my answer to How to define a figure size so that it consumes the rest of a page?. Some of that code might be published as part of the TeX.SX-TikZ bundle.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\currentsidemargin}{%
  \ifodd\value{page}%
    \oddsidemargin%
  \else%
    \evensidemargin%
  \fi%
}

\newlength{\whatsleft}

\newcommand{\measureremainder}[1]{%
\begin{tikzpicture}[overlay,remember picture]
    % Helper nodes
    \path (current page.north west) ++(\hoffset, -\voffset)
        node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\paperwidth, minimum height=\paperheight]
        (pagearea) {};


    \path (pagearea.north west) ++(1in+\currentsidemargin,-1in-\topmargin-\headheight-\headsep)
        node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\textwidth, minimum height=\textheight]
        (textarea) {};

    % Measure distance to right text border
    \path let \p0 = (0,0), \p1 = (textarea.east) in
        [/utils/exec={\pgfmathsetlength#1{\x1-\x0}\global#1=#1}];

\end{tikzpicture}%
}


\begin{document}
\section{test}

Some long paragraph of text \measureremainder{\whatsleft}\begin{minipage}[t]{\whatsleft}
    \hrulefill
\end{minipage}

Some short text \measureremainder{\whatsleft}\begin{minipage}[t]{\whatsleft}
    \hrulefill
\end{minipage}

Some long long long long long long long long long long long long long
long long long long long long long long long long long text \measureremainder{\whatsleft}\begin{minipage}[t]{\whatsleft}
    \hrulefill
\end{minipage}

\end{document}

Result:

Example

(The horizontal lines represent the width of the minipage.)

Update 2011/09/15:

I just uploaded the new package tikzpagenodes to CTAN, which simplifies the above code as follows:

\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\newcommand{\measureremainder}[1]{%
\begin{tikzpicture}[overlay,remember picture]
    % Measure distance to right text border
    \path let \p0 = (0,0), \p1 = (current page text area.east) in
        [/utils/exec={\pgfmathsetlength#1{\x1-\x0}\global#1=#1}];
\end{tikzpicture}%
}

The zref, zref-savepos package has the option to save the position of a marker. In normal text it works quite well. Inside lists it is a different story. On c.t.t. it was explained as: \item doesn't actually print anything, nor does it start a new line. It saves the box containing the bullet, and arranges for \everypar to print it whenever the next paragraph starts, which is after you have have marked the current position (which is then just above the coming new line and at the left margin.

The problem is illustrated by using the linegoal package (it uses zref internaly)

\documentclass{article}
\usepackage{linegoal}
\begin{document}
This is a test \rlap{\rule[.5ex]{\linegoal}{0.5pt}}{}of line goal and all
kinds of everything else here and here again all kinds of everything else
here and here again
\begin{itemize}
  \item This is a test \rlap{\rule[.5ex]{\linegoal}{0.5pt}}{}of line goal
      and all kinds of everything else here and here again all kinds of
      everything else here and here again
\end{itemize}
\end{document}

You can try the linegoal package.